From 158840b5db64afd4ccaf28a3baf1efe60a2ad64a Mon Sep 17 00:00:00 2001 From: Shuxian Wang Date: Tue, 24 Jan 2023 15:19:59 -0800 Subject: [PATCH 01/11] Generate logical part. --- src/pipeline/relation.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pipeline/relation.rs b/src/pipeline/relation.rs index ad02456..5e6a458 100644 --- a/src/pipeline/relation.rs +++ b/src/pipeline/relation.rs @@ -127,7 +127,8 @@ impl Eval for Env<'_> { } }); let app = if schema.primary.is_empty() { - App(Rel::Var(VL(t)), vars.clone()) + let app = App(Rel::Var(VL(t)), vars.clone()); + app.clone() * UExpr::squash(app) } else { let key_constraints = schema.primary.iter().enumerate().flat_map(|(j, cols)| { From 339a470284411e5ed89c50e7004ab9d08b10bacd Mon Sep 17 00:00:00 2001 From: Shuxian Wang Date: Tue, 2 May 2023 11:33:26 -0700 Subject: [PATCH 02/11] Ready for benchmark. --- .github/workflows/build.yml | 2 +- Cargo.lock | 235 ++- Cargo.toml | 1 + flake.lock | 60 +- flake.nix | 6 +- src/main.rs | 3 +- src/pipeline/normal.rs | 279 +-- src/pipeline/null.rs | 77 +- src/pipeline/partial.rs | 87 +- src/pipeline/relation.rs | 86 +- src/pipeline/shared.rs | 158 +- src/pipeline/stable.rs | 46 +- src/pipeline/syntax.rs | 16 +- src/pipeline/unify.rs | 208 ++- .../testAddRedundantSemiJoinRule.json | 136 -- .../testAggregateCaseToFilter.json | 1335 -------------- .../testAggregateConstantKeyRule.json | 307 ---- .../testAggregateConstantKeyRule3.json | 424 ----- .../testAggregateDynamicFunction.json | 396 ---- .../testAggregateExtractProjectRule.json | 112 -- ...ateExtractProjectRuleWithGroupingSets.json | 198 -- ...teExtractProjectRuleWithGroupingSets2.json | 195 -- ...testAggregateGroupingSetsProjectMerge.json | 288 --- .../testAggregateJoinRemove1.json | 208 --- .../testAggregateJoinRemove10.json | 393 ---- .../testAggregateJoinRemove11.json | 245 --- .../testAggregateJoinRemove2.json | 245 --- .../testAggregateJoinRemove3.json | 289 --- .../testAggregateJoinRemove4.json | 160 -- .../testAggregateJoinRemove5.json | 245 --- .../testAggregateJoinRemove6.json | 289 --- .../testAggregateJoinRemove7.json | 296 --- .../testAggregateJoinRemove8.json | 353 ---- .../testAggregateJoinRemove9.json | 363 ---- .../RelOptRulesTest/testAggregateMerge1.json | 532 ------ .../RelOptRulesTest/testAggregateMerge2.json | 534 ------ .../RelOptRulesTest/testAggregateMerge8.json | 242 --- .../testAggregateMergeSum0.json | 339 ---- .../testAggregateProjectMerge.json | 288 --- .../testAggregateProjectPullUpConstants.json | 379 ---- .../testAggregateProjectPullUpConstants2.json | 238 --- .../RelOptRulesTest/testAggregateRemove1.json | 298 --- .../RelOptRulesTest/testAggregateRemove2.json | 37 - .../RelOptRulesTest/testAggregateRemove3.json | 219 --- .../RelOptRulesTest/testAggregateRemove7.json | 541 ------ ...egateUnionTransposeWithOneInputUnique.json | 1090 ----------- ...ransposeWithTopLevelGroupSetRemapping.json | 956 ---------- tests/RelOptRulesTest/testAll.json | 454 ----- .../testAlreadyFalseEliminatesFilter.json | 77 - .../testAntiJoinProjectTranspose.json | 348 ---- .../testAnyInProjectNonNullable.json | 345 ---- .../testAnyInProjectNullable.json | 350 ---- ...ReuseDistinctAttrWithMixedOptionality.json | 251 --- ...ReuseDistinctAttrWithMixedOptionality.json | 251 --- .../testCasePushIsAlwaysWorking.json | 162 -- ...AggregateExpandDistinctAggregatesRule.json | 1095 ----------- .../testCastInAggregateReduceFunctions.json | 664 ------- ...omColumnResolvingInCorrelatedSubQuery.json | 407 ----- ...mColumnResolvingInCorrelatedSubQuery2.json | 340 ---- ...olumnResolvingInNonCorrelatedSubQuery.json | 255 --- ...estDecorrelateAggWithConstantGroupKey.json | 820 --------- .../testDecorrelateExists.json | 262 --- .../testDecorrelateTwoExists.json | 506 ------ .../RelOptRulesTest/testDecorrelateTwoIn.json | 333 ---- ...lateUncorrelatedInAndCorrelatedExists.json | 466 ----- ...estOfApproximateDistinctAggregateCall.json | 351 ---- tests/RelOptRulesTest/testDistinctCount1.json | 310 ---- tests/RelOptRulesTest/testDistinctCount2.json | 572 ------ tests/RelOptRulesTest/testDistinctCount3.json | 496 ----- .../testDistinctCountGroupingSets1.json | 565 ------ .../testDistinctCountGroupingSets2.json | 719 -------- .../testDistinctCountMixed.json | 604 ------- .../testDistinctCountMixed2.json | 719 -------- .../testDistinctCountMixedJoin.json | 1153 ------------ .../testDistinctCountMultiple.json | 568 ------ .../testDistinctCountMultipleNoGroup.json | 393 ---- .../testDistinctCountMultipleViaJoin.json | 1153 ------------ .../testDistinctCountWithExpandSumType.json | 258 --- .../testDistinctCountWithoutGroupBy.json | 401 ----- .../testDistinctNonDistinctAggregates.json | 560 ------ ...nctNonDistinctAggregatesWithGrouping1.json | 544 ------ ...nctNonDistinctAggregatesWithGrouping2.json | 406 ----- ...tNonDistinctTwoAggregatesWithGrouping.json | 496 ----- ...istinctWithDiffFiltersAndSameGroupSet.json | 620 ------- .../testDistinctWithFilterAndGroupBy.json | 766 -------- .../testDistinctWithFilterWithoutGroupBy.json | 623 ------- .../testDistinctWithGrouping.json | 349 ---- .../testDistinctWithMultipleInputs.json | 531 ------ ...tDistinctWithMultipleInputsAndGroupby.json | 535 ------ tests/RelOptRulesTest/testEmptyAggregate.json | 103 -- ...regateEmptyKeyWithAggregateValuesRule.json | 92 - .../testEmptyFilterProjectUnion.json | 176 -- tests/RelOptRulesTest/testEmptyIntersect.json | 165 -- tests/RelOptRulesTest/testEmptyMinus.json | 157 -- tests/RelOptRulesTest/testEmptyMinus2.json | 287 --- tests/RelOptRulesTest/testEmptyProject.json | 110 -- tests/RelOptRulesTest/testEmptyProject2.json | 110 -- tests/RelOptRulesTest/testEmptySort.json | 133 -- tests/RelOptRulesTest/testEmptySort2.json | 45 - .../testEmptySortLimitZero.json | 87 - .../testExistsWithAtLeastOneRowSubQuery.json | 199 -- .../testExistsWithNoRowSubQuery.json | 74 - .../testExpandFilterExists.json | 334 ---- .../testExpandFilterExistsSimple.json | 260 --- .../testExpandFilterExistsSimpleAnd.json | 318 ---- tests/RelOptRulesTest/testExpandFilterIn.json | 400 ---- .../testExpandFilterIn3Value.json | 897 --------- .../testExpandFilterInComposite.json | 318 ---- .../testExpandFilterScalar.json | 530 ------ .../RelOptRulesTest/testExpandJoinExists.json | 330 ---- .../RelOptRulesTest/testExpandJoinScalar.json | 531 ------ .../testExpandProjectExists.json | 276 --- .../RelOptRulesTest/testExpandProjectIn.json | 358 ---- .../testExpandProjectInComposite.json | 276 --- .../testExpandProjectInNullable.json | 805 --------- .../testExpandProjectScalar.json | 265 --- .../testExpandWhereComparisonCorrelated.json | 361 ---- .../testExpressionSimplification1.json | 201 --- .../testExpressionSimplification2.json | 243 --- .../testExtractJoinFilterRule.json | 123 -- .../testExtractYearMonthToRange.json | 234 --- .../testExtractYearToRange.json | 202 --- .../testFilterJoinRuleAndIsNotNull.json | 315 ---- .../testFilterJoinRuleOrIsNotNull.json | 315 ---- .../testFilterProjectTranspose.json | 400 ---- ...testFilterRemoveIsNotDistinctFromRule.json | 96 - ...estFlattenUncorrelatedCallBelowEquals.json | 486 ----- ...elatedTwoLevelCallBelowEqualsSucceeds.json | 530 ------ ...estFullOuterJoinSimplificationToInner.json | 209 --- ...ullOuterJoinSimplificationToLeftOuter.json | 166 -- ...llOuterJoinSimplificationToRightOuter.json | 166 -- .../testGroupByBooleanLiteralSimple.json | 282 --- .../testGroupByDateLiteralSimple.json | 282 --- .../testGroupByMultipleLiterals.json | 594 ------ ...dicatesWithNotOperatorInJoinCondition.json | 371 ---- .../testIntersectToDistinct.json | 902 ---------- tests/RelOptRulesTest/testIsNullPushDown.json | 47 - .../RelOptRulesTest/testIsNullPushDown2.json | 47 - ...eWithBottomAlwaysTrueConditionAllowed.json | 223 --- ...RuleWithTopAlwaysTrueConditionAllowed.json | 194 -- ...uteRuleWithAlwaysTrueConditionAllowed.json | 164 -- .../testJoinConditionPushdown1.json | 359 ---- .../testJoinConditionPushdown2.json | 270 --- .../testJoinConditionPushdown4.json | 163 -- .../testJoinConditionPushdown6.json | 261 --- .../testJoinDeriveIsNotNullFilterRule1.json | 145 -- .../testJoinDeriveIsNotNullFilterRule12.json | 196 -- .../testJoinDeriveIsNotNullFilterRule2.json | 159 -- .../testJoinDeriveIsNotNullFilterRule3.json | 145 -- .../testJoinDeriveIsNotNullFilterRule4.json | 228 --- .../testJoinDeriveIsNotNullFilterRule5.json | 209 --- .../testJoinProjectTranspose1.json | 239 --- .../testJoinProjectTranspose7.json | 101 -- .../testJoinProjectTranspose8.json | 205 --- .../testJoinProjectTransposeWindow.json | 203 --- ...testJoinPushTransitivePredicatesRule2.json | 1602 ----------------- .../testLeftEmptyAntiJoin.json | 100 - .../testLeftEmptyFullJoin.json | 287 --- .../testLeftEmptyInnerJoin.json | 267 --- .../testLeftEmptyLeftJoin.json | 267 --- .../testLeftEmptyRightJoin.json | 287 --- .../testLeftEmptySemiJoin.json | 100 - ...estLeftOuterJoinSimplificationToInner.json | 166 -- ...ReuseDistinctAttrWithMixedOptionality.json | 251 --- tests/RelOptRulesTest/testMergeFilter.json | 128 -- tests/RelOptRulesTest/testMergeIntersect.json | 448 ----- .../RelOptRulesTest/testMergeJoinFilter.json | 182 -- tests/RelOptRulesTest/testMergeMinus.json | 454 ----- tests/RelOptRulesTest/testMergeUnionAll.json | 448 ----- .../testMergeUnionDistinct.json | 454 ----- .../RelOptRulesTest/testMergeUnionMixed2.json | 452 ----- ...ReuseDistinctAttrWithMixedOptionality.json | 251 --- tests/RelOptRulesTest/testMinusMergeRule.json | 439 ----- .../testMultipleDistinctWithGrouping.json | 635 ------- .../testNoOversimplificationBelowIsNull.json | 308 ---- tests/RelOptRulesTest/testOrAlwaysTrue.json | 244 --- tests/RelOptRulesTest/testOrAlwaysTrue2.json | 244 --- .../testOversimplifiedCaseStatement.json | 294 --- .../testProjectAggregateMerge.json | 306 ---- .../testProjectAggregateMergeSum0.json | 149 -- .../testProjectAggregateMergeSum0AndSum.json | 201 --- ...ctCorrelateTransposeRuleLeftCorrelate.json | 364 ---- .../testProjectJoinRemove1.json | 128 -- .../testProjectJoinRemove10.json | 87 - .../testProjectJoinRemove4.json | 80 - .../testProjectJoinRemove7.json | 80 - .../testProjectJoinTransposeItem.json | 274 --- .../testProjectSetOpTranspose.json | 134 -- .../testPullAggregateThroughUnion.json | 625 ------- .../testPullAggregateThroughUnion2.json | 625 ------- ...llAggregateThroughUnionAndAddProjects.json | 457 ----- ...estPullAggregateThroughUnionWithAlias.json | 589 ------ .../testPullConstantIntoFilter.json | 312 ---- .../testPullConstantIntoJoin.json | 355 ---- .../testPullConstantIntoJoin2.json | 451 ----- .../testPullConstantIntoProject.json | 145 -- ...stantIntoProjectWithIsNotDistinctFrom.json | 223 --- ...toProjectWithIsNotDistinctFromForNull.json | 164 -- ...tPullConstantThroughAggregateAllConst.json | 368 ---- ...llConstantThroughAggregateAllLiterals.json | 368 ---- ...lConstantThroughAggregateConstGroupBy.json | 292 --- ...tPullConstantThroughAggregatePermuted.json | 413 ----- ...antThroughAggregatePermutedConstFirst.json | 253 --- ...tThroughAggregatePermutedConstGroupBy.json | 275 --- ...tantThroughAggregateSimpleNonNullable.json | 253 --- .../testPullConstantThroughConstLast.json | 253 --- .../testPullConstantThroughUnion.json | 132 -- .../testPullConstantThroughUnion3.json | 186 -- .../testPullFilterThroughAggregate.json | 261 --- ...ullFilterThroughAggregateGroupingSets.json | 448 ----- tests/RelOptRulesTest/testPullNull.json | 260 --- ...ushAboveFiltersIntoInnerJoinCondition.json | 281 --- ...testPushAggregateFunctionsThroughJoin.json | 593 ------ .../testPushAggregateSumNoGroup.json | 473 ----- .../testPushAggregateSumThroughJoin.json | 488 ----- ...ateSumThroughJoinAfterAggregateReduce.json | 794 -------- ...ggregateSumWithoutGroupKeyThroughJoin.json | 704 -------- .../testPushAggregateThroughJoin1.json | 391 ---- .../testPushAggregateThroughJoin2.json | 1036 ----------- .../testPushAggregateThroughJoin4.json | 220 --- .../testPushAggregateThroughJoin5.json | 228 --- .../testPushAggregateThroughJoin6.json | 556 ------ .../testPushAggregateThroughJoin7.json | 488 ----- .../testPushAggregateThroughJoin8.json | 488 ----- .../testPushAggregateThroughJoinDistinct.json | 411 ----- ...regateThroughJoinOnEmptyLogicalValues.json | 527 ------ ...shAggregateThroughJoinWithUniqueInput.json | 1319 -------------- .../testPushAggregateThroughOuterJoin1.json | 573 ------ .../testPushAggregateThroughOuterJoin12.json | 597 ------ .../testPushAggregateThroughOuterJoin13.json | 597 ------ .../testPushAggregateThroughOuterJoin14.json | 498 ----- .../testPushAggregateThroughOuterJoin15.json | 802 --------- .../testPushAggregateThroughOuterJoin16.json | 1000 ---------- .../testPushAggregateThroughOuterJoin2.json | 619 ------- .../testPushAggregateThroughOuterJoin3.json | 802 --------- .../testPushAggregateThroughOuterJoin4.json | 383 ---- .../testPushAggregateThroughOuterJoin5.json | 597 ------ .../testPushAggregateThroughOuterJoin6.json | 391 ---- .../testPushAggregateThroughOuterJoin7.json | 1000 ---------- .../testPushAggregateThroughOuterJoin8.json | 1000 ---------- .../testPushAggregateThroughOuterJoin9.json | 1036 ----------- .../testPushAvgGroupingSetsThroughUnion.json | 334 ---- .../testPushAvgThroughUnion.json | 271 --- .../testPushBoolAndBoolOrThroughUnion.json | 935 ---------- .../testPushCountFilterThroughUnion.json | 880 --------- ...CountNullableGroupingSetsThroughUnion.json | 718 -------- .../testPushCountNullableThroughUnion.json | 427 ----- ...PushCountStarGroupingSetsThroughUnion.json | 650 ------- .../testPushCountStarThroughUnion.json | 399 ---- .../testPushFilterPastAgg.json | 199 -- .../testPushFilterPastAggFour.json | 577 ------ .../testPushFilterPastAggTwo.json | 377 ---- ...estPushFilterPastAggWithGroupingSets2.json | 334 ---- .../testPushFilterPastProject.json | 267 --- .../testPushFilterSemijoin.json | 168 -- .../testPushFilterThroughSemiJoin.json | 133 -- ...shFilterWithIsNotDistinctFromPastJoin.json | 334 ---- .../testPushJoinCondDownToProject.json | 187 -- .../testPushJoinThroughUnionOnLeft.json | 214 --- .../testPushJoinThroughUnionOnRight.json | 213 --- ...shMaxNullableGroupingSetsThroughUnion.json | 718 -------- .../testPushMaxNullableThroughUnion.json | 427 ----- .../testPushMinGroupingSetsThroughUnion.json | 722 -------- .../testPushMinThroughUnion.json | 571 ------ .../testPushProjectPastFilter.json | 198 -- .../testPushProjectPastFilter2.json | 210 --- .../testPushProjectPastFilter3b.json | 308 ---- .../testPushProjectPastFilter3c.json | 304 ---- .../testPushProjectPastFullJoin.json | 499 ----- .../testPushProjectPastFullJoinStrong.json | 487 ----- .../testPushProjectPastInnerJoin.json | 491 ----- .../testPushProjectPastInnerJoinStrong.json | 487 ----- .../testPushProjectPastJoin.json | 197 -- .../testPushProjectPastLeftJoin.json | 491 ----- .../testPushProjectPastLeftJoinSwap.json | 499 ----- ...testPushProjectPastLeftJoinSwapStrong.json | 487 ----- .../testPushProjectPastRightJoin.json | 499 ----- .../testPushProjectPastRightJoinStrong.json | 487 ----- .../testPushProjectPastRightJoinSwap.json | 491 ----- ...estPushProjectPastRightJoinSwapStrong.json | 487 ----- .../testPushProjectPastSetOp.json | 44 - ...hProjectWithIsNotDistinctFromPastJoin.json | 307 ---- .../testPushProjectWithOverPastJoin1.json | 218 --- .../testPushProjectWithOverPastJoin2.json | 209 --- .../testPushProjectWithOverPastJoin3.json | 252 --- .../testPushSemiJoinConditions.json | 249 --- .../testPushSemiJoinPastFilter.json | 186 -- .../testPushSemiJoinPastJoinRuleLeft.json | 260 --- .../testPushSemiJoinPastJoinRuleRight.json | 253 --- .../testPushSemiJoinPastProject.json | 274 --- ...shSumConstantGroupingSetsThroughUnion.json | 799 -------- .../testPushSumConstantThroughUnion.json | 604 ------- ...hSumCountStarGroupingSetsThroughUnion.json | 913 ---------- .../testPushSumCountStarThroughUnion.json | 805 --------- ...mNullConstantGroupingSetsThroughUnion.json | 799 -------- .../testPushSumNullConstantThroughUnion.json | 604 ------- ...shSumNullableGroupingSetsThroughUnion.json | 718 -------- .../testPushSumNullableNOGBYThroughUnion.json | 304 ---- .../testPushSumNullableThroughUnion.json | 427 ----- .../testReduceAggregateFunctionsByGroup.json | 306 ---- .../testReduceAllAggregateFunctions.json | 664 ------- tests/RelOptRulesTest/testReduceAverage.json | 284 --- ...AverageAndSumWithNoReduceStddevAndVar.json | 308 ---- ...ReduceAverageAndVarWithNoReduceStddev.json | 410 ----- .../testReduceAverageWithNoReduceSum.json | 284 --- tests/RelOptRulesTest/testReduceCase.json | 118 -- .../testReduceCaseNullabilityChange.json | 130 -- .../testReduceCastAndConsts.json | 219 --- tests/RelOptRulesTest/testReduceCasts.json | 307 ---- .../testReduceCompositeInSubQuery.json | 453 ----- .../RelOptRulesTest/testReduceConstants.json | 376 ---- .../RelOptRulesTest/testReduceConstants3.json | 176 -- .../testReduceConstantsCaseEquals.json | 272 --- .../testReduceConstantsCaseEquals2.json | 272 --- .../testReduceConstantsCaseEquals3.json | 352 ---- .../testReduceConstantsDup.json | 90 - .../testReduceConstantsDup2.json | 237 --- .../testReduceConstantsDup3.json | 74 - .../testReduceConstantsDup3Null.json | 111 -- .../testReduceConstantsDupNot.json | 80 - .../testReduceConstantsDupNot2.json | 118 -- .../testReduceConstantsDupNot2Null.json | 156 -- .../testReduceConstantsDupNotNull.json | 117 -- .../testReduceConstantsEliminatesFilter.json | 110 -- .../testReduceConstantsIsNotNull.json | 72 - .../testReduceConstantsIsNull.json | 43 - .../testReduceConstantsNegated.json | 103 -- .../testReduceConstantsNegatedInverted.json | 97 - .../testReduceConstantsNull.json | 130 -- .../testReduceConstantsNullEqualsOne.json | 218 --- .../testReduceConstantsProjectNullable.json | 85 - .../testReduceConstantsRequiresExecutor.json | 110 -- tests/RelOptRulesTest/testReduceDynamic.json | 102 -- .../testReduceNestedCaseWhen.json | 154 -- .../testReduceNullableToNotNull.json | 103 -- .../testReduceNullableToNotNull2.json | 103 -- .../RelOptRulesTest/testReduceOrCaseWhen.json | 133 -- .../testReduceValuesToEmpty.json | 110 -- .../testReduceValuesUnderFilter.json | 112 -- .../testReduceValuesUnderProject.json | 86 - .../testReduceValuesUnderProjectFilter.json | 157 -- .../testReduceWithNonTypePredicate.json | 220 --- .../testRemoveDistinctOnAgg.json | 306 ---- tests/RelOptRulesTest/testRemoveSemiJoin.json | 124 -- .../testRemoveSemiJoinRight.json | 199 -- .../testRemoveSemiJoinRightWithFilter.json | 236 --- .../testRemoveSemiJoinWithFilter.json | 164 -- .../testRightEmptyAntiJoin.json | 86 - .../testRightEmptyAntiJoinNonEqui.json | 110 -- .../testRightEmptyFullJoin.json | 252 --- .../testRightEmptyInnerJoin.json | 239 --- .../testRightEmptyLeftJoin.json | 252 --- .../testRightEmptyRightJoin.json | 239 --- .../testRightEmptySemiJoin.json | 98 - ...stRightOuterJoinSimplificationToInner.json | 166 -- .../testSemiJoinProjectTranspose.json | 348 ---- .../testSemiJoinReduceConstants.json | 194 -- tests/RelOptRulesTest/testSemiJoinRule.json | 247 --- .../testSemiJoinRuleExists.json | 247 --- .../RelOptRulesTest/testSemiJoinRuleLeft.json | 202 --- .../testSemiJoinRuleWithHint.json | 203 --- ...testSemiJoinRuleWithJoinOnUniqueInput.json | 162 -- tests/RelOptRulesTest/testSemiJoinTrim.json | 231 --- tests/RelOptRulesTest/testSimplifyFilter.json | 323 ---- .../testSkipReduceConstantsCaseEquals.json | 375 ---- tests/RelOptRulesTest/testSome.json | 436 ----- .../RelOptRulesTest/testSomeWithEquality.json | 199 -- .../testSomeWithEquality2.json | 243 --- .../testSomeWithNotEquality.json | 497 ----- .../testSortJoinCopyInnerJoinOrderBy.json | 256 --- ...testSortJoinCopyInnerJoinOrderByLimit.json | 266 --- ...SortJoinCopyInnerJoinOrderByTwoFields.json | 277 --- .../testSortJoinCopySemiJoinOrderBy.json | 128 -- ...ortJoinCopySemiJoinOrderByLimitOffset.json | 148 -- ...testSortJoinCopySemiJoinOrderByOffset.json | 138 -- .../testSortJoinTranspose1.json | 271 --- .../testSortJoinTranspose2.json | 256 --- .../testSortJoinTranspose4.json | 256 --- .../testSortJoinTranspose6.json | 172 -- .../testSortProjectTranspose1.json | 94 - .../testSortProjectTranspose2.json | 106 -- .../testSortRemovalAllKeysConstant.json | 352 ---- .../testSortRemovalOneKeyConstant.json | 376 ---- .../testSortUnionTranspose.json | 108 -- .../testSortUnionTranspose2.json | 88 - .../testSortUnionTranspose3.json | 25 - .../testSpatialContainsPoint.json | 199 -- .../testSpatialDWithinLine.json | 220 --- .../testSpatialDWithinReversed.json | 198 -- .../testSpatialDWithinToHilbert.json | 198 -- .../testSpatialDWithinToHilbertNegative.json | 152 -- .../testSpatialDWithinToHilbertZero.json | 193 -- tests/RelOptRulesTest/testSpatialReduce.json | 85 - .../testStrengthenJoinType.json | 375 ---- ...estSumAndDistinctSumWithExpandSumType.json | 278 --- tests/RelOptRulesTest/testSwapOuterJoin.json | 125 -- .../testTransitiveInferenceAggregate.json | 287 --- ...stTransitiveInferenceComplexPredicate.json | 361 ---- ...stTransitiveInferenceConjunctInPullUp.json | 153 -- .../testTransitiveInferenceJoin.json | 153 -- .../testTransitiveInferenceJoin3way.json | 216 --- .../testTransitiveInferenceJoin3wayAgg.json | 350 ---- .../testTransitiveInferenceLeftOuterJoin.json | 191 -- .../testTransitiveInferenceProject.json | 153 -- ...estTransitiveInferencePullUpThruAlias.json | 196 -- ...testTransitiveInferenceRightOuterJoin.json | 191 -- .../testTransitiveInferenceUnion.json | 205 --- .../testTransitiveInferenceUnion3way.json | 257 --- ...estTransitiveInferenceUnionAlwaysTrue.json | 183 -- ...IsFlattenedOnlyIfSiblingOfCorrelation.json | 660 ------- tests/RelOptRulesTest/testUnionMergeRule.json | 183 -- .../testUnionToDistinctRule.json | 126 -- .../testWhereAnyCorrelatedInSelect.json | 519 ------ .../testWhereExpressionInCorrelated.json | 414 ----- .../testWhereExpressionInCorrelated2.json | 399 ---- .../testWhereInCorrelated.json | 168 -- .../testWhereInJoinCorrelated.json | 373 ---- .../testWhereNotInCorrelated.json | 370 ---- .../testWhereNotInCorrelated2.json | 591 ------ .../RelOptRulesTest/testWhereOrSubQuery.json | 276 --- tests/RelOptRulesTest/testWithinDistinct.json | 752 -------- .../testWithinDistinctCountDistinct.json | 915 ---------- .../testWithinDistinctFilteredAggs.json | 1596 ---------------- ...tWithinDistinctFilteredAggsSameFilter.json | 1492 --------------- ...stinctFilteredAggsUniformDistinctKeys.json | 1316 -------------- ...ilteredAggsUniformDistinctKeysNoThrow.json | 932 ---------- .../testWithinDistinctNoThrow.json | 624 ------- ...testWithinDistinctUniformDistinctKeys.json | 724 -------- ...hinDistinctUniformDistinctKeysNoThrow.json | 540 ------ .../testAddRedundantSemiJoinRule.json | 1 + .../benchmark/testAggregateCaseToFilter.json | 1 + .../testAggregateConstantKeyRule.json | 1 + .../testAggregateConstantKeyRule3.json | 1 + .../testAggregateDynamicFunction.json | 1 + .../testAggregateExtractProjectRule.json | 1 + ...ateExtractProjectRuleWithGroupingSets.json | 1 + ...teExtractProjectRuleWithGroupingSets2.json | 1 + ...testAggregateGroupingSetsProjectMerge.json | 1 + tests/benchmark/testAggregateJoinRemove1.json | 1 + .../benchmark/testAggregateJoinRemove10.json | 1 + .../benchmark/testAggregateJoinRemove11.json | 1 + tests/benchmark/testAggregateJoinRemove2.json | 1 + tests/benchmark/testAggregateJoinRemove3.json | 1 + tests/benchmark/testAggregateJoinRemove4.json | 1 + tests/benchmark/testAggregateJoinRemove5.json | 1 + tests/benchmark/testAggregateJoinRemove6.json | 1 + tests/benchmark/testAggregateJoinRemove7.json | 1 + tests/benchmark/testAggregateJoinRemove8.json | 1 + tests/benchmark/testAggregateJoinRemove9.json | 1 + tests/benchmark/testAggregateMerge1.json | 1 + tests/benchmark/testAggregateMerge2.json | 1 + tests/benchmark/testAggregateMerge8.json | 1 + tests/benchmark/testAggregateMergeSum0.json | 1 + .../benchmark/testAggregateProjectMerge.json | 1 + .../testAggregateProjectPullUpConstants.json | 1 + .../testAggregateProjectPullUpConstants2.json | 1 + tests/benchmark/testAggregateRemove1.json | 1 + tests/benchmark/testAggregateRemove2.json | 1 + tests/benchmark/testAggregateRemove3.json | 1 + tests/benchmark/testAggregateRemove7.json | 1 + ...egateUnionTransposeWithOneInputUnique.json | 1 + ...ransposeWithTopLevelGroupSetRemapping.json | 1 + tests/benchmark/testAll.json | 1 + .../testAlreadyFalseEliminatesFilter.json | 1 + .../testAntiJoinProjectTranspose.json | 1 + .../testAnyInProjectNonNullable.json | 1 + tests/benchmark/testAnyInProjectNullable.json | 1 + ...ReuseDistinctAttrWithMixedOptionality.json | 1 + ...ReuseDistinctAttrWithMixedOptionality.json | 1 + .../testCasePushIsAlwaysWorking.json | 1 + ...AggregateExpandDistinctAggregatesRule.json | 1 + .../testCastInAggregateReduceFunctions.json | 1 + ...omColumnResolvingInCorrelatedSubQuery.json | 1 + ...mColumnResolvingInCorrelatedSubQuery2.json | 1 + ...olumnResolvingInNonCorrelatedSubQuery.json | 1 + ...estDecorrelateAggWithConstantGroupKey.json | 1 + tests/benchmark/testDecorrelateExists.json | 1 + tests/benchmark/testDecorrelateTwoExists.json | 1 + tests/benchmark/testDecorrelateTwoIn.json | 1 + ...lateUncorrelatedInAndCorrelatedExists.json | 1 + ...estOfApproximateDistinctAggregateCall.json | 1 + tests/benchmark/testDistinctCount1.json | 1 + tests/benchmark/testDistinctCount2.json | 1 + tests/benchmark/testDistinctCount3.json | 1 + .../testDistinctCountGroupingSets1.json | 1 + .../testDistinctCountGroupingSets2.json | 1 + tests/benchmark/testDistinctCountMixed.json | 1 + tests/benchmark/testDistinctCountMixed2.json | 1 + .../benchmark/testDistinctCountMixedJoin.json | 1 + .../benchmark/testDistinctCountMultiple.json | 1 + .../testDistinctCountMultipleNoGroup.json | 1 + .../testDistinctCountMultipleViaJoin.json | 1 + .../testDistinctCountWithExpandSumType.json | 1 + .../testDistinctCountWithoutGroupBy.json | 1 + .../testDistinctNonDistinctAggregates.json | 1 + ...nctNonDistinctAggregatesWithGrouping1.json | 1 + ...nctNonDistinctAggregatesWithGrouping2.json | 1 + ...tNonDistinctTwoAggregatesWithGrouping.json | 1 + ...istinctWithDiffFiltersAndSameGroupSet.json | 1 + .../testDistinctWithFilterAndGroupBy.json | 1 + .../testDistinctWithFilterWithoutGroupBy.json | 1 + tests/benchmark/testDistinctWithGrouping.json | 1 + .../testDistinctWithMultipleInputs.json | 1 + ...tDistinctWithMultipleInputsAndGroupby.json | 1 + tests/benchmark/testEmptyAggregate.json | 1 + ...regateEmptyKeyWithAggregateValuesRule.json | 1 + .../testEmptyFilterProjectUnion.json | 1 + tests/benchmark/testEmptyIntersect.json | 1 + tests/benchmark/testEmptyMinus.json | 1 + tests/benchmark/testEmptyMinus2.json | 1 + tests/benchmark/testEmptyProject.json | 1 + tests/benchmark/testEmptyProject2.json | 1 + tests/benchmark/testEmptySort.json | 1 + tests/benchmark/testEmptySort2.json | 1 + tests/benchmark/testEmptySortLimitZero.json | 1 + .../testExistsWithAtLeastOneRowSubQuery.json | 1 + .../testExistsWithNoRowSubQuery.json | 1 + tests/benchmark/testExpandFilterExists.json | 1 + .../testExpandFilterExistsSimple.json | 1 + .../testExpandFilterExistsSimpleAnd.json | 1 + tests/benchmark/testExpandFilterIn.json | 1 + tests/benchmark/testExpandFilterIn3Value.json | 1 + .../testExpandFilterInComposite.json | 1 + tests/benchmark/testExpandFilterScalar.json | 1 + tests/benchmark/testExpandJoinExists.json | 1 + tests/benchmark/testExpandJoinScalar.json | 1 + tests/benchmark/testExpandProjectExists.json | 1 + tests/benchmark/testExpandProjectIn.json | 1 + .../testExpandProjectInComposite.json | 1 + .../testExpandProjectInNullable.json | 1 + tests/benchmark/testExpandProjectScalar.json | 1 + .../testExpandWhereComparisonCorrelated.json | 1 + .../testExpressionSimplification1.json | 1 + .../testExpressionSimplification2.json | 1 + .../benchmark/testExtractJoinFilterRule.json | 1 + .../testExtractYearMonthToRange.json | 1 + tests/benchmark/testExtractYearToRange.json | 1 + .../testFilterJoinRuleAndIsNotNull.json | 1 + .../testFilterJoinRuleOrIsNotNull.json | 1 + .../benchmark/testFilterProjectTranspose.json | 1 + ...testFilterRemoveIsNotDistinctFromRule.json | 1 + ...estFlattenUncorrelatedCallBelowEquals.json | 1 + ...elatedTwoLevelCallBelowEqualsSucceeds.json | 1 + ...estFullOuterJoinSimplificationToInner.json | 1 + ...ullOuterJoinSimplificationToLeftOuter.json | 1 + ...llOuterJoinSimplificationToRightOuter.json | 1 + .../testGroupByBooleanLiteralSimple.json | 1 + .../testGroupByDateLiteralSimple.json | 1 + .../testGroupByMultipleLiterals.json | 1 + ...dicatesWithNotOperatorInJoinCondition.json | 1 + tests/benchmark/testIntersectToDistinct.json | 1 + tests/benchmark/testIsNullPushDown.json | 1 + tests/benchmark/testIsNullPushDown2.json | 1 + ...eWithBottomAlwaysTrueConditionAllowed.json | 1 + ...RuleWithTopAlwaysTrueConditionAllowed.json | 1 + ...uteRuleWithAlwaysTrueConditionAllowed.json | 1 + .../benchmark/testJoinConditionPushdown1.json | 1 + .../benchmark/testJoinConditionPushdown2.json | 1 + .../benchmark/testJoinConditionPushdown4.json | 1 + .../benchmark/testJoinConditionPushdown6.json | 1 + .../testJoinDeriveIsNotNullFilterRule1.json | 1 + .../testJoinDeriveIsNotNullFilterRule12.json | 1 + .../testJoinDeriveIsNotNullFilterRule2.json | 1 + .../testJoinDeriveIsNotNullFilterRule3.json | 1 + .../testJoinDeriveIsNotNullFilterRule4.json | 1 + .../testJoinDeriveIsNotNullFilterRule5.json | 1 + .../benchmark/testJoinProjectTranspose1.json | 1 + .../benchmark/testJoinProjectTranspose7.json | 1 + .../benchmark/testJoinProjectTranspose8.json | 1 + .../testJoinProjectTransposeWindow.json | 1 + ...testJoinPushTransitivePredicatesRule2.json | 1 + tests/benchmark/testLeftEmptyAntiJoin.json | 1 + tests/benchmark/testLeftEmptyFullJoin.json | 1 + tests/benchmark/testLeftEmptyInnerJoin.json | 1 + tests/benchmark/testLeftEmptyLeftJoin.json | 1 + tests/benchmark/testLeftEmptyRightJoin.json | 1 + tests/benchmark/testLeftEmptySemiJoin.json | 1 + ...estLeftOuterJoinSimplificationToInner.json | 1 + ...ReuseDistinctAttrWithMixedOptionality.json | 1 + tests/benchmark/testMergeFilter.json | 1 + tests/benchmark/testMergeIntersect.json | 1 + tests/benchmark/testMergeJoinFilter.json | 1 + tests/benchmark/testMergeMinus.json | 1 + tests/benchmark/testMergeUnionAll.json | 1 + tests/benchmark/testMergeUnionDistinct.json | 1 + tests/benchmark/testMergeUnionMixed2.json | 1 + ...ReuseDistinctAttrWithMixedOptionality.json | 1 + tests/benchmark/testMinusMergeRule.json | 1 + .../testMultipleDistinctWithGrouping.json | 1 + .../testNoOversimplificationBelowIsNull.json | 1 + tests/benchmark/testOrAlwaysTrue.json | 1 + tests/benchmark/testOrAlwaysTrue2.json | 1 + .../testOversimplifiedCaseStatement.json | 1 + .../benchmark/testProjectAggregateMerge.json | 1 + .../testProjectAggregateMergeSum0.json | 1 + .../testProjectAggregateMergeSum0AndSum.json | 1 + ...ctCorrelateTransposeRuleLeftCorrelate.json | 1 + tests/benchmark/testProjectJoinRemove1.json | 1 + tests/benchmark/testProjectJoinRemove10.json | 1 + tests/benchmark/testProjectJoinRemove4.json | 1 + tests/benchmark/testProjectJoinRemove7.json | 1 + .../testProjectJoinTransposeItem.json | 1 + .../benchmark/testProjectSetOpTranspose.json | 1 + .../testPullAggregateThroughUnion.json | 1 + .../testPullAggregateThroughUnion2.json | 1 + ...llAggregateThroughUnionAndAddProjects.json | 1 + ...estPullAggregateThroughUnionWithAlias.json | 1 + .../benchmark/testPullConstantIntoFilter.json | 1 + tests/benchmark/testPullConstantIntoJoin.json | 1 + .../benchmark/testPullConstantIntoJoin2.json | 1 + .../testPullConstantIntoProject.json | 1 + ...stantIntoProjectWithIsNotDistinctFrom.json | 1 + ...toProjectWithIsNotDistinctFromForNull.json | 1 + ...tPullConstantThroughAggregateAllConst.json | 1 + ...llConstantThroughAggregateAllLiterals.json | 1 + ...lConstantThroughAggregateConstGroupBy.json | 1 + ...tPullConstantThroughAggregatePermuted.json | 1 + ...antThroughAggregatePermutedConstFirst.json | 1 + ...tThroughAggregatePermutedConstGroupBy.json | 1 + ...tantThroughAggregateSimpleNonNullable.json | 1 + .../testPullConstantThroughConstLast.json | 1 + .../testPullConstantThroughUnion.json | 1 + .../testPullConstantThroughUnion3.json | 1 + .../testPullFilterThroughAggregate.json | 1 + ...ullFilterThroughAggregateGroupingSets.json | 1 + tests/benchmark/testPullNull.json | 1 + ...ushAboveFiltersIntoInnerJoinCondition.json | 1 + ...testPushAggregateFunctionsThroughJoin.json | 1 + .../testPushAggregateSumNoGroup.json | 1 + .../testPushAggregateSumThroughJoin.json | 1 + ...ateSumThroughJoinAfterAggregateReduce.json | 1 + ...ggregateSumWithoutGroupKeyThroughJoin.json | 1 + .../testPushAggregateThroughJoin1.json | 1 + .../testPushAggregateThroughJoin2.json | 1 + .../testPushAggregateThroughJoin4.json | 1 + .../testPushAggregateThroughJoin5.json | 1 + .../testPushAggregateThroughJoin6.json | 1 + .../testPushAggregateThroughJoin7.json | 1 + .../testPushAggregateThroughJoin8.json | 1 + .../testPushAggregateThroughJoinDistinct.json | 1 + ...regateThroughJoinOnEmptyLogicalValues.json | 1 + ...shAggregateThroughJoinWithUniqueInput.json | 1 + .../testPushAggregateThroughOuterJoin1.json | 1 + .../testPushAggregateThroughOuterJoin12.json | 1 + .../testPushAggregateThroughOuterJoin13.json | 1 + .../testPushAggregateThroughOuterJoin14.json | 1 + .../testPushAggregateThroughOuterJoin15.json | 1 + .../testPushAggregateThroughOuterJoin16.json | 1 + .../testPushAggregateThroughOuterJoin2.json | 1 + .../testPushAggregateThroughOuterJoin3.json | 1 + .../testPushAggregateThroughOuterJoin4.json | 1 + .../testPushAggregateThroughOuterJoin5.json | 1 + .../testPushAggregateThroughOuterJoin6.json | 1 + .../testPushAggregateThroughOuterJoin7.json | 1 + .../testPushAggregateThroughOuterJoin8.json | 1 + .../testPushAggregateThroughOuterJoin9.json | 1 + .../testPushAvgGroupingSetsThroughUnion.json | 1 + tests/benchmark/testPushAvgThroughUnion.json | 1 + .../testPushBoolAndBoolOrThroughUnion.json | 1 + .../testPushCountFilterThroughUnion.json | 1 + ...CountNullableGroupingSetsThroughUnion.json | 1 + .../testPushCountNullableThroughUnion.json | 1 + ...PushCountStarGroupingSetsThroughUnion.json | 1 + .../testPushCountStarThroughUnion.json | 1 + tests/benchmark/testPushFilterPastAgg.json | 1 + .../benchmark/testPushFilterPastAggFour.json | 1 + tests/benchmark/testPushFilterPastAggTwo.json | 1 + ...estPushFilterPastAggWithGroupingSets2.json | 1 + .../benchmark/testPushFilterPastProject.json | 1 + tests/benchmark/testPushFilterSemijoin.json | 1 + .../testPushFilterThroughSemiJoin.json | 1 + ...shFilterWithIsNotDistinctFromPastJoin.json | 1 + .../testPushJoinCondDownToProject.json | 1 + .../testPushJoinThroughUnionOnLeft.json | 1 + .../testPushJoinThroughUnionOnRight.json | 1 + ...shMaxNullableGroupingSetsThroughUnion.json | 1 + .../testPushMaxNullableThroughUnion.json | 1 + .../testPushMinGroupingSetsThroughUnion.json | 1 + tests/benchmark/testPushMinThroughUnion.json | 1 + .../benchmark/testPushProjectPastFilter.json | 1 + .../benchmark/testPushProjectPastFilter2.json | 1 + .../testPushProjectPastFilter3b.json | 1 + .../testPushProjectPastFilter3c.json | 1 + .../testPushProjectPastFullJoin.json | 1 + .../testPushProjectPastFullJoinStrong.json | 1 + .../testPushProjectPastInnerJoin.json | 1 + .../testPushProjectPastInnerJoinStrong.json | 1 + tests/benchmark/testPushProjectPastJoin.json | 1 + .../testPushProjectPastLeftJoin.json | 1 + .../testPushProjectPastLeftJoinSwap.json | 1 + ...testPushProjectPastLeftJoinSwapStrong.json | 1 + .../testPushProjectPastRightJoin.json | 1 + .../testPushProjectPastRightJoinStrong.json | 1 + .../testPushProjectPastRightJoinSwap.json | 1 + ...estPushProjectPastRightJoinSwapStrong.json | 1 + tests/benchmark/testPushProjectPastSetOp.json | 1 + ...hProjectWithIsNotDistinctFromPastJoin.json | 1 + .../testPushProjectWithOverPastJoin1.json | 1 + .../testPushProjectWithOverPastJoin2.json | 1 + .../testPushProjectWithOverPastJoin3.json | 1 + .../benchmark/testPushSemiJoinConditions.json | 1 + .../benchmark/testPushSemiJoinPastFilter.json | 1 + .../testPushSemiJoinPastJoinRuleLeft.json | 1 + .../testPushSemiJoinPastJoinRuleRight.json | 1 + .../testPushSemiJoinPastProject.json | 1 + ...shSumConstantGroupingSetsThroughUnion.json | 1 + .../testPushSumConstantThroughUnion.json | 1 + ...hSumCountStarGroupingSetsThroughUnion.json | 1 + .../testPushSumCountStarThroughUnion.json | 1 + ...mNullConstantGroupingSetsThroughUnion.json | 1 + .../testPushSumNullConstantThroughUnion.json | 1 + ...shSumNullableGroupingSetsThroughUnion.json | 1 + .../testPushSumNullableNOGBYThroughUnion.json | 1 + .../testPushSumNullableThroughUnion.json | 1 + .../testReduceAggregateFunctionsByGroup.json | 1 + .../testReduceAllAggregateFunctions.json | 1 + tests/benchmark/testReduceAverage.json | 1 + ...AverageAndSumWithNoReduceStddevAndVar.json | 1 + ...ReduceAverageAndVarWithNoReduceStddev.json | 1 + .../testReduceAverageWithNoReduceSum.json | 1 + tests/benchmark/testReduceCase.json | 1 + .../testReduceCaseNullabilityChange.json | 1 + tests/benchmark/testReduceCastAndConsts.json | 1 + tests/benchmark/testReduceCasts.json | 1 + .../testReduceCompositeInSubQuery.json | 1 + tests/benchmark/testReduceConstants.json | 1 + tests/benchmark/testReduceConstants3.json | 1 + .../testReduceConstantsCaseEquals.json | 1 + .../testReduceConstantsCaseEquals2.json | 1 + .../testReduceConstantsCaseEquals3.json | 1 + tests/benchmark/testReduceConstantsDup.json | 1 + tests/benchmark/testReduceConstantsDup2.json | 1 + tests/benchmark/testReduceConstantsDup3.json | 1 + .../testReduceConstantsDup3Null.json | 1 + .../benchmark/testReduceConstantsDupNot.json | 1 + .../benchmark/testReduceConstantsDupNot2.json | 1 + .../testReduceConstantsDupNot2Null.json | 1 + .../testReduceConstantsDupNotNull.json | 1 + .../testReduceConstantsEliminatesFilter.json | 1 + .../testReduceConstantsIsNotNull.json | 1 + .../benchmark/testReduceConstantsIsNull.json | 1 + .../benchmark/testReduceConstantsNegated.json | 1 + .../testReduceConstantsNegatedInverted.json | 1 + tests/benchmark/testReduceConstantsNull.json | 1 + .../testReduceConstantsNullEqualsOne.json | 1 + .../testReduceConstantsProjectNullable.json | 1 + .../testReduceConstantsRequiresExecutor.json | 1 + tests/benchmark/testReduceDynamic.json | 1 + tests/benchmark/testReduceNestedCaseWhen.json | 1 + .../testReduceNullableToNotNull.json | 1 + .../testReduceNullableToNotNull2.json | 1 + tests/benchmark/testReduceOrCaseWhen.json | 1 + tests/benchmark/testReduceValuesToEmpty.json | 1 + .../testReduceValuesUnderFilter.json | 1 + .../testReduceValuesUnderProject.json | 1 + .../testReduceValuesUnderProjectFilter.json | 1 + .../testReduceWithNonTypePredicate.json | 1 + tests/benchmark/testRemoveDistinctOnAgg.json | 1 + tests/benchmark/testRemoveSemiJoin.json | 1 + tests/benchmark/testRemoveSemiJoinRight.json | 1 + .../testRemoveSemiJoinRightWithFilter.json | 1 + .../testRemoveSemiJoinWithFilter.json | 1 + tests/benchmark/testRightEmptyAntiJoin.json | 1 + .../testRightEmptyAntiJoinNonEqui.json | 1 + tests/benchmark/testRightEmptyFullJoin.json | 1 + tests/benchmark/testRightEmptyInnerJoin.json | 1 + tests/benchmark/testRightEmptyLeftJoin.json | 1 + tests/benchmark/testRightEmptyRightJoin.json | 1 + tests/benchmark/testRightEmptySemiJoin.json | 1 + ...stRightOuterJoinSimplificationToInner.json | 1 + .../testSemiJoinProjectTranspose.json | 1 + .../testSemiJoinReduceConstants.json | 1 + tests/benchmark/testSemiJoinRule.json | 1 + tests/benchmark/testSemiJoinRuleExists.json | 1 + tests/benchmark/testSemiJoinRuleLeft.json | 1 + tests/benchmark/testSemiJoinRuleWithHint.json | 1 + ...testSemiJoinRuleWithJoinOnUniqueInput.json | 1 + tests/benchmark/testSemiJoinTrim.json | 1 + tests/benchmark/testSimplifyFilter.json | 1 + .../testSkipReduceConstantsCaseEquals.json | 1 + tests/benchmark/testSome.json | 1 + tests/benchmark/testSomeWithEquality.json | 1 + tests/benchmark/testSomeWithEquality2.json | 1 + tests/benchmark/testSomeWithNotEquality.json | 1 + .../testSortJoinCopyInnerJoinOrderBy.json | 1 + ...testSortJoinCopyInnerJoinOrderByLimit.json | 1 + ...SortJoinCopyInnerJoinOrderByTwoFields.json | 1 + .../testSortJoinCopySemiJoinOrderBy.json | 1 + ...ortJoinCopySemiJoinOrderByLimitOffset.json | 1 + ...testSortJoinCopySemiJoinOrderByOffset.json | 1 + tests/benchmark/testSortJoinTranspose1.json | 1 + tests/benchmark/testSortJoinTranspose2.json | 1 + tests/benchmark/testSortJoinTranspose4.json | 1 + tests/benchmark/testSortJoinTranspose6.json | 1 + .../benchmark/testSortProjectTranspose1.json | 1 + .../benchmark/testSortProjectTranspose2.json | 1 + .../testSortRemovalAllKeysConstant.json | 1 + .../testSortRemovalOneKeyConstant.json | 1 + tests/benchmark/testSortUnionTranspose.json | 1 + tests/benchmark/testSortUnionTranspose2.json | 1 + tests/benchmark/testSortUnionTranspose3.json | 1 + tests/benchmark/testSpatialContainsPoint.json | 1 + tests/benchmark/testSpatialDWithinLine.json | 1 + .../benchmark/testSpatialDWithinReversed.json | 1 + .../testSpatialDWithinToHilbert.json | 1 + .../testSpatialDWithinToHilbertNegative.json | 1 + .../testSpatialDWithinToHilbertZero.json | 1 + tests/benchmark/testSpatialReduce.json | 1 + tests/benchmark/testStrengthenJoinType.json | 1 + ...estSumAndDistinctSumWithExpandSumType.json | 1 + tests/benchmark/testSwapOuterJoin.json | 1 + .../testTransitiveInferenceAggregate.json | 1 + ...stTransitiveInferenceComplexPredicate.json | 1 + ...stTransitiveInferenceConjunctInPullUp.json | 1 + .../testTransitiveInferenceJoin.json | 1 + .../testTransitiveInferenceJoin3way.json | 1 + .../testTransitiveInferenceJoin3wayAgg.json | 1 + .../testTransitiveInferenceLeftOuterJoin.json | 1 + .../testTransitiveInferenceProject.json | 1 + ...estTransitiveInferencePullUpThruAlias.json | 1 + ...testTransitiveInferenceRightOuterJoin.json | 1 + .../testTransitiveInferenceUnion.json | 1 + .../testTransitiveInferenceUnion3way.json | 1 + ...estTransitiveInferenceUnionAlwaysTrue.json | 1 + ...IsFlattenedOnlyIfSiblingOfCorrelation.json | 1 + tests/benchmark/testUnionMergeRule.json | 1 + tests/benchmark/testUnionToDistinctRule.json | 1 + .../testWhereAnyCorrelatedInSelect.json | 1 + .../testWhereExpressionInCorrelated.json | 1 + .../testWhereExpressionInCorrelated2.json | 1 + tests/benchmark/testWhereInCorrelated.json | 1 + .../benchmark/testWhereInJoinCorrelated.json | 1 + tests/benchmark/testWhereNotInCorrelated.json | 1 + .../benchmark/testWhereNotInCorrelated2.json | 1 + tests/benchmark/testWhereOrSubQuery.json | 1 + tests/benchmark/testWithinDistinct.json | 1 + .../testWithinDistinctCountDistinct.json | 1 + .../testWithinDistinctFilteredAggs.json | 1 + ...tWithinDistinctFilteredAggsSameFilter.json | 1 + ...stinctFilteredAggsUniformDistinctKeys.json | 1 + ...ilteredAggsUniformDistinctKeysNoThrow.json | 1 + .../benchmark/testWithinDistinctNoThrow.json | 1 + ...testWithinDistinctUniformDistinctKeys.json | 1 + ...hinDistinctUniformDistinctKeysNoThrow.json | 1 + 844 files changed, 1113 insertions(+), 148845 deletions(-) delete mode 100644 tests/RelOptRulesTest/testAddRedundantSemiJoinRule.json delete mode 100644 tests/RelOptRulesTest/testAggregateCaseToFilter.json delete mode 100644 tests/RelOptRulesTest/testAggregateConstantKeyRule.json delete mode 100644 tests/RelOptRulesTest/testAggregateConstantKeyRule3.json delete mode 100644 tests/RelOptRulesTest/testAggregateDynamicFunction.json delete mode 100644 tests/RelOptRulesTest/testAggregateExtractProjectRule.json delete mode 100644 tests/RelOptRulesTest/testAggregateExtractProjectRuleWithGroupingSets.json delete mode 100644 tests/RelOptRulesTest/testAggregateExtractProjectRuleWithGroupingSets2.json delete mode 100644 tests/RelOptRulesTest/testAggregateGroupingSetsProjectMerge.json delete mode 100644 tests/RelOptRulesTest/testAggregateJoinRemove1.json delete mode 100644 tests/RelOptRulesTest/testAggregateJoinRemove10.json delete mode 100644 tests/RelOptRulesTest/testAggregateJoinRemove11.json delete mode 100644 tests/RelOptRulesTest/testAggregateJoinRemove2.json delete mode 100644 tests/RelOptRulesTest/testAggregateJoinRemove3.json delete mode 100644 tests/RelOptRulesTest/testAggregateJoinRemove4.json delete mode 100644 tests/RelOptRulesTest/testAggregateJoinRemove5.json delete mode 100644 tests/RelOptRulesTest/testAggregateJoinRemove6.json delete mode 100644 tests/RelOptRulesTest/testAggregateJoinRemove7.json delete mode 100644 tests/RelOptRulesTest/testAggregateJoinRemove8.json delete mode 100644 tests/RelOptRulesTest/testAggregateJoinRemove9.json delete mode 100644 tests/RelOptRulesTest/testAggregateMerge1.json delete mode 100644 tests/RelOptRulesTest/testAggregateMerge2.json delete mode 100644 tests/RelOptRulesTest/testAggregateMerge8.json delete mode 100644 tests/RelOptRulesTest/testAggregateMergeSum0.json delete mode 100644 tests/RelOptRulesTest/testAggregateProjectMerge.json delete mode 100644 tests/RelOptRulesTest/testAggregateProjectPullUpConstants.json delete mode 100644 tests/RelOptRulesTest/testAggregateProjectPullUpConstants2.json delete mode 100644 tests/RelOptRulesTest/testAggregateRemove1.json delete mode 100644 tests/RelOptRulesTest/testAggregateRemove2.json delete mode 100644 tests/RelOptRulesTest/testAggregateRemove3.json delete mode 100644 tests/RelOptRulesTest/testAggregateRemove7.json delete mode 100644 tests/RelOptRulesTest/testAggregateUnionTransposeWithOneInputUnique.json delete mode 100644 tests/RelOptRulesTest/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json delete mode 100644 tests/RelOptRulesTest/testAll.json delete mode 100644 tests/RelOptRulesTest/testAlreadyFalseEliminatesFilter.json delete mode 100644 tests/RelOptRulesTest/testAntiJoinProjectTranspose.json delete mode 100644 tests/RelOptRulesTest/testAnyInProjectNonNullable.json delete mode 100644 tests/RelOptRulesTest/testAnyInProjectNullable.json delete mode 100644 tests/RelOptRulesTest/testBitAndReuseDistinctAttrWithMixedOptionality.json delete mode 100644 tests/RelOptRulesTest/testBitOrReuseDistinctAttrWithMixedOptionality.json delete mode 100644 tests/RelOptRulesTest/testCasePushIsAlwaysWorking.json delete mode 100644 tests/RelOptRulesTest/testCastInAggregateExpandDistinctAggregatesRule.json delete mode 100644 tests/RelOptRulesTest/testCastInAggregateReduceFunctions.json delete mode 100644 tests/RelOptRulesTest/testCustomColumnResolvingInCorrelatedSubQuery.json delete mode 100644 tests/RelOptRulesTest/testCustomColumnResolvingInCorrelatedSubQuery2.json delete mode 100644 tests/RelOptRulesTest/testCustomColumnResolvingInNonCorrelatedSubQuery.json delete mode 100644 tests/RelOptRulesTest/testDecorrelateAggWithConstantGroupKey.json delete mode 100644 tests/RelOptRulesTest/testDecorrelateExists.json delete mode 100644 tests/RelOptRulesTest/testDecorrelateTwoExists.json delete mode 100644 tests/RelOptRulesTest/testDecorrelateTwoIn.json delete mode 100644 tests/RelOptRulesTest/testDecorrelateUncorrelatedInAndCorrelatedExists.json delete mode 100644 tests/RelOptRulesTest/testDigestOfApproximateDistinctAggregateCall.json delete mode 100644 tests/RelOptRulesTest/testDistinctCount1.json delete mode 100644 tests/RelOptRulesTest/testDistinctCount2.json delete mode 100644 tests/RelOptRulesTest/testDistinctCount3.json delete mode 100644 tests/RelOptRulesTest/testDistinctCountGroupingSets1.json delete mode 100644 tests/RelOptRulesTest/testDistinctCountGroupingSets2.json delete mode 100644 tests/RelOptRulesTest/testDistinctCountMixed.json delete mode 100644 tests/RelOptRulesTest/testDistinctCountMixed2.json delete mode 100644 tests/RelOptRulesTest/testDistinctCountMixedJoin.json delete mode 100644 tests/RelOptRulesTest/testDistinctCountMultiple.json delete mode 100644 tests/RelOptRulesTest/testDistinctCountMultipleNoGroup.json delete mode 100644 tests/RelOptRulesTest/testDistinctCountMultipleViaJoin.json delete mode 100644 tests/RelOptRulesTest/testDistinctCountWithExpandSumType.json delete mode 100644 tests/RelOptRulesTest/testDistinctCountWithoutGroupBy.json delete mode 100644 tests/RelOptRulesTest/testDistinctNonDistinctAggregates.json delete mode 100644 tests/RelOptRulesTest/testDistinctNonDistinctAggregatesWithGrouping1.json delete mode 100644 tests/RelOptRulesTest/testDistinctNonDistinctAggregatesWithGrouping2.json delete mode 100644 tests/RelOptRulesTest/testDistinctNonDistinctTwoAggregatesWithGrouping.json delete mode 100644 tests/RelOptRulesTest/testDistinctWithDiffFiltersAndSameGroupSet.json delete mode 100644 tests/RelOptRulesTest/testDistinctWithFilterAndGroupBy.json delete mode 100644 tests/RelOptRulesTest/testDistinctWithFilterWithoutGroupBy.json delete mode 100644 tests/RelOptRulesTest/testDistinctWithGrouping.json delete mode 100644 tests/RelOptRulesTest/testDistinctWithMultipleInputs.json delete mode 100644 tests/RelOptRulesTest/testDistinctWithMultipleInputsAndGroupby.json delete mode 100644 tests/RelOptRulesTest/testEmptyAggregate.json delete mode 100644 tests/RelOptRulesTest/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json delete mode 100644 tests/RelOptRulesTest/testEmptyFilterProjectUnion.json delete mode 100644 tests/RelOptRulesTest/testEmptyIntersect.json delete mode 100644 tests/RelOptRulesTest/testEmptyMinus.json delete mode 100644 tests/RelOptRulesTest/testEmptyMinus2.json delete mode 100644 tests/RelOptRulesTest/testEmptyProject.json delete mode 100644 tests/RelOptRulesTest/testEmptyProject2.json delete mode 100644 tests/RelOptRulesTest/testEmptySort.json delete mode 100644 tests/RelOptRulesTest/testEmptySort2.json delete mode 100644 tests/RelOptRulesTest/testEmptySortLimitZero.json delete mode 100644 tests/RelOptRulesTest/testExistsWithAtLeastOneRowSubQuery.json delete mode 100644 tests/RelOptRulesTest/testExistsWithNoRowSubQuery.json delete mode 100644 tests/RelOptRulesTest/testExpandFilterExists.json delete mode 100644 tests/RelOptRulesTest/testExpandFilterExistsSimple.json delete mode 100644 tests/RelOptRulesTest/testExpandFilterExistsSimpleAnd.json delete mode 100644 tests/RelOptRulesTest/testExpandFilterIn.json delete mode 100644 tests/RelOptRulesTest/testExpandFilterIn3Value.json delete mode 100644 tests/RelOptRulesTest/testExpandFilterInComposite.json delete mode 100644 tests/RelOptRulesTest/testExpandFilterScalar.json delete mode 100644 tests/RelOptRulesTest/testExpandJoinExists.json delete mode 100644 tests/RelOptRulesTest/testExpandJoinScalar.json delete mode 100644 tests/RelOptRulesTest/testExpandProjectExists.json delete mode 100644 tests/RelOptRulesTest/testExpandProjectIn.json delete mode 100644 tests/RelOptRulesTest/testExpandProjectInComposite.json delete mode 100644 tests/RelOptRulesTest/testExpandProjectInNullable.json delete mode 100644 tests/RelOptRulesTest/testExpandProjectScalar.json delete mode 100644 tests/RelOptRulesTest/testExpandWhereComparisonCorrelated.json delete mode 100644 tests/RelOptRulesTest/testExpressionSimplification1.json delete mode 100644 tests/RelOptRulesTest/testExpressionSimplification2.json delete mode 100644 tests/RelOptRulesTest/testExtractJoinFilterRule.json delete mode 100644 tests/RelOptRulesTest/testExtractYearMonthToRange.json delete mode 100644 tests/RelOptRulesTest/testExtractYearToRange.json delete mode 100644 tests/RelOptRulesTest/testFilterJoinRuleAndIsNotNull.json delete mode 100644 tests/RelOptRulesTest/testFilterJoinRuleOrIsNotNull.json delete mode 100644 tests/RelOptRulesTest/testFilterProjectTranspose.json delete mode 100644 tests/RelOptRulesTest/testFilterRemoveIsNotDistinctFromRule.json delete mode 100644 tests/RelOptRulesTest/testFlattenUncorrelatedCallBelowEquals.json delete mode 100644 tests/RelOptRulesTest/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json delete mode 100644 tests/RelOptRulesTest/testFullOuterJoinSimplificationToInner.json delete mode 100644 tests/RelOptRulesTest/testFullOuterJoinSimplificationToLeftOuter.json delete mode 100644 tests/RelOptRulesTest/testFullOuterJoinSimplificationToRightOuter.json delete mode 100644 tests/RelOptRulesTest/testGroupByBooleanLiteralSimple.json delete mode 100644 tests/RelOptRulesTest/testGroupByDateLiteralSimple.json delete mode 100644 tests/RelOptRulesTest/testGroupByMultipleLiterals.json delete mode 100644 tests/RelOptRulesTest/testInferringPredicatesWithNotOperatorInJoinCondition.json delete mode 100644 tests/RelOptRulesTest/testIntersectToDistinct.json delete mode 100644 tests/RelOptRulesTest/testIsNullPushDown.json delete mode 100644 tests/RelOptRulesTest/testIsNullPushDown2.json delete mode 100644 tests/RelOptRulesTest/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json delete mode 100644 tests/RelOptRulesTest/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json delete mode 100644 tests/RelOptRulesTest/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json delete mode 100644 tests/RelOptRulesTest/testJoinConditionPushdown1.json delete mode 100644 tests/RelOptRulesTest/testJoinConditionPushdown2.json delete mode 100644 tests/RelOptRulesTest/testJoinConditionPushdown4.json delete mode 100644 tests/RelOptRulesTest/testJoinConditionPushdown6.json delete mode 100644 tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule1.json delete mode 100644 tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule12.json delete mode 100644 tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule2.json delete mode 100644 tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule3.json delete mode 100644 tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule4.json delete mode 100644 tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule5.json delete mode 100644 tests/RelOptRulesTest/testJoinProjectTranspose1.json delete mode 100644 tests/RelOptRulesTest/testJoinProjectTranspose7.json delete mode 100644 tests/RelOptRulesTest/testJoinProjectTranspose8.json delete mode 100644 tests/RelOptRulesTest/testJoinProjectTransposeWindow.json delete mode 100644 tests/RelOptRulesTest/testJoinPushTransitivePredicatesRule2.json delete mode 100644 tests/RelOptRulesTest/testLeftEmptyAntiJoin.json delete mode 100644 tests/RelOptRulesTest/testLeftEmptyFullJoin.json delete mode 100644 tests/RelOptRulesTest/testLeftEmptyInnerJoin.json delete mode 100644 tests/RelOptRulesTest/testLeftEmptyLeftJoin.json delete mode 100644 tests/RelOptRulesTest/testLeftEmptyRightJoin.json delete mode 100644 tests/RelOptRulesTest/testLeftEmptySemiJoin.json delete mode 100644 tests/RelOptRulesTest/testLeftOuterJoinSimplificationToInner.json delete mode 100644 tests/RelOptRulesTest/testMaxReuseDistinctAttrWithMixedOptionality.json delete mode 100644 tests/RelOptRulesTest/testMergeFilter.json delete mode 100644 tests/RelOptRulesTest/testMergeIntersect.json delete mode 100644 tests/RelOptRulesTest/testMergeJoinFilter.json delete mode 100644 tests/RelOptRulesTest/testMergeMinus.json delete mode 100644 tests/RelOptRulesTest/testMergeUnionAll.json delete mode 100644 tests/RelOptRulesTest/testMergeUnionDistinct.json delete mode 100644 tests/RelOptRulesTest/testMergeUnionMixed2.json delete mode 100644 tests/RelOptRulesTest/testMinReuseDistinctAttrWithMixedOptionality.json delete mode 100644 tests/RelOptRulesTest/testMinusMergeRule.json delete mode 100644 tests/RelOptRulesTest/testMultipleDistinctWithGrouping.json delete mode 100644 tests/RelOptRulesTest/testNoOversimplificationBelowIsNull.json delete mode 100644 tests/RelOptRulesTest/testOrAlwaysTrue.json delete mode 100644 tests/RelOptRulesTest/testOrAlwaysTrue2.json delete mode 100644 tests/RelOptRulesTest/testOversimplifiedCaseStatement.json delete mode 100644 tests/RelOptRulesTest/testProjectAggregateMerge.json delete mode 100644 tests/RelOptRulesTest/testProjectAggregateMergeSum0.json delete mode 100644 tests/RelOptRulesTest/testProjectAggregateMergeSum0AndSum.json delete mode 100644 tests/RelOptRulesTest/testProjectCorrelateTransposeRuleLeftCorrelate.json delete mode 100644 tests/RelOptRulesTest/testProjectJoinRemove1.json delete mode 100644 tests/RelOptRulesTest/testProjectJoinRemove10.json delete mode 100644 tests/RelOptRulesTest/testProjectJoinRemove4.json delete mode 100644 tests/RelOptRulesTest/testProjectJoinRemove7.json delete mode 100644 tests/RelOptRulesTest/testProjectJoinTransposeItem.json delete mode 100644 tests/RelOptRulesTest/testProjectSetOpTranspose.json delete mode 100644 tests/RelOptRulesTest/testPullAggregateThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPullAggregateThroughUnion2.json delete mode 100644 tests/RelOptRulesTest/testPullAggregateThroughUnionAndAddProjects.json delete mode 100644 tests/RelOptRulesTest/testPullAggregateThroughUnionWithAlias.json delete mode 100644 tests/RelOptRulesTest/testPullConstantIntoFilter.json delete mode 100644 tests/RelOptRulesTest/testPullConstantIntoJoin.json delete mode 100644 tests/RelOptRulesTest/testPullConstantIntoJoin2.json delete mode 100644 tests/RelOptRulesTest/testPullConstantIntoProject.json delete mode 100644 tests/RelOptRulesTest/testPullConstantIntoProjectWithIsNotDistinctFrom.json delete mode 100644 tests/RelOptRulesTest/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json delete mode 100644 tests/RelOptRulesTest/testPullConstantThroughAggregateAllConst.json delete mode 100644 tests/RelOptRulesTest/testPullConstantThroughAggregateAllLiterals.json delete mode 100644 tests/RelOptRulesTest/testPullConstantThroughAggregateConstGroupBy.json delete mode 100644 tests/RelOptRulesTest/testPullConstantThroughAggregatePermuted.json delete mode 100644 tests/RelOptRulesTest/testPullConstantThroughAggregatePermutedConstFirst.json delete mode 100644 tests/RelOptRulesTest/testPullConstantThroughAggregatePermutedConstGroupBy.json delete mode 100644 tests/RelOptRulesTest/testPullConstantThroughAggregateSimpleNonNullable.json delete mode 100644 tests/RelOptRulesTest/testPullConstantThroughConstLast.json delete mode 100644 tests/RelOptRulesTest/testPullConstantThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPullConstantThroughUnion3.json delete mode 100644 tests/RelOptRulesTest/testPullFilterThroughAggregate.json delete mode 100644 tests/RelOptRulesTest/testPullFilterThroughAggregateGroupingSets.json delete mode 100644 tests/RelOptRulesTest/testPullNull.json delete mode 100644 tests/RelOptRulesTest/testPushAboveFiltersIntoInnerJoinCondition.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateFunctionsThroughJoin.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateSumNoGroup.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateSumThroughJoin.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateSumThroughJoinAfterAggregateReduce.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateSumWithoutGroupKeyThroughJoin.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughJoin1.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughJoin2.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughJoin4.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughJoin5.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughJoin6.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughJoin7.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughJoin8.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughJoinDistinct.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughJoinOnEmptyLogicalValues.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughJoinWithUniqueInput.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughOuterJoin1.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughOuterJoin12.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughOuterJoin13.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughOuterJoin14.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughOuterJoin15.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughOuterJoin16.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughOuterJoin2.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughOuterJoin3.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughOuterJoin4.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughOuterJoin5.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughOuterJoin6.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughOuterJoin7.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughOuterJoin8.json delete mode 100644 tests/RelOptRulesTest/testPushAggregateThroughOuterJoin9.json delete mode 100644 tests/RelOptRulesTest/testPushAvgGroupingSetsThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushAvgThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushBoolAndBoolOrThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushCountFilterThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushCountNullableGroupingSetsThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushCountNullableThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushCountStarGroupingSetsThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushCountStarThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushFilterPastAgg.json delete mode 100644 tests/RelOptRulesTest/testPushFilterPastAggFour.json delete mode 100644 tests/RelOptRulesTest/testPushFilterPastAggTwo.json delete mode 100644 tests/RelOptRulesTest/testPushFilterPastAggWithGroupingSets2.json delete mode 100644 tests/RelOptRulesTest/testPushFilterPastProject.json delete mode 100644 tests/RelOptRulesTest/testPushFilterSemijoin.json delete mode 100644 tests/RelOptRulesTest/testPushFilterThroughSemiJoin.json delete mode 100644 tests/RelOptRulesTest/testPushFilterWithIsNotDistinctFromPastJoin.json delete mode 100644 tests/RelOptRulesTest/testPushJoinCondDownToProject.json delete mode 100644 tests/RelOptRulesTest/testPushJoinThroughUnionOnLeft.json delete mode 100644 tests/RelOptRulesTest/testPushJoinThroughUnionOnRight.json delete mode 100644 tests/RelOptRulesTest/testPushMaxNullableGroupingSetsThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushMaxNullableThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushMinGroupingSetsThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushMinThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushProjectPastFilter.json delete mode 100644 tests/RelOptRulesTest/testPushProjectPastFilter2.json delete mode 100644 tests/RelOptRulesTest/testPushProjectPastFilter3b.json delete mode 100644 tests/RelOptRulesTest/testPushProjectPastFilter3c.json delete mode 100644 tests/RelOptRulesTest/testPushProjectPastFullJoin.json delete mode 100644 tests/RelOptRulesTest/testPushProjectPastFullJoinStrong.json delete mode 100644 tests/RelOptRulesTest/testPushProjectPastInnerJoin.json delete mode 100644 tests/RelOptRulesTest/testPushProjectPastInnerJoinStrong.json delete mode 100644 tests/RelOptRulesTest/testPushProjectPastJoin.json delete mode 100644 tests/RelOptRulesTest/testPushProjectPastLeftJoin.json delete mode 100644 tests/RelOptRulesTest/testPushProjectPastLeftJoinSwap.json delete mode 100644 tests/RelOptRulesTest/testPushProjectPastLeftJoinSwapStrong.json delete mode 100644 tests/RelOptRulesTest/testPushProjectPastRightJoin.json delete mode 100644 tests/RelOptRulesTest/testPushProjectPastRightJoinStrong.json delete mode 100644 tests/RelOptRulesTest/testPushProjectPastRightJoinSwap.json delete mode 100644 tests/RelOptRulesTest/testPushProjectPastRightJoinSwapStrong.json delete mode 100644 tests/RelOptRulesTest/testPushProjectPastSetOp.json delete mode 100644 tests/RelOptRulesTest/testPushProjectWithIsNotDistinctFromPastJoin.json delete mode 100644 tests/RelOptRulesTest/testPushProjectWithOverPastJoin1.json delete mode 100644 tests/RelOptRulesTest/testPushProjectWithOverPastJoin2.json delete mode 100644 tests/RelOptRulesTest/testPushProjectWithOverPastJoin3.json delete mode 100644 tests/RelOptRulesTest/testPushSemiJoinConditions.json delete mode 100644 tests/RelOptRulesTest/testPushSemiJoinPastFilter.json delete mode 100644 tests/RelOptRulesTest/testPushSemiJoinPastJoinRuleLeft.json delete mode 100644 tests/RelOptRulesTest/testPushSemiJoinPastJoinRuleRight.json delete mode 100644 tests/RelOptRulesTest/testPushSemiJoinPastProject.json delete mode 100644 tests/RelOptRulesTest/testPushSumConstantGroupingSetsThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushSumConstantThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushSumCountStarGroupingSetsThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushSumCountStarThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushSumNullConstantGroupingSetsThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushSumNullConstantThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushSumNullableGroupingSetsThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushSumNullableNOGBYThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testPushSumNullableThroughUnion.json delete mode 100644 tests/RelOptRulesTest/testReduceAggregateFunctionsByGroup.json delete mode 100644 tests/RelOptRulesTest/testReduceAllAggregateFunctions.json delete mode 100644 tests/RelOptRulesTest/testReduceAverage.json delete mode 100644 tests/RelOptRulesTest/testReduceAverageAndSumWithNoReduceStddevAndVar.json delete mode 100644 tests/RelOptRulesTest/testReduceAverageAndVarWithNoReduceStddev.json delete mode 100644 tests/RelOptRulesTest/testReduceAverageWithNoReduceSum.json delete mode 100644 tests/RelOptRulesTest/testReduceCase.json delete mode 100644 tests/RelOptRulesTest/testReduceCaseNullabilityChange.json delete mode 100644 tests/RelOptRulesTest/testReduceCastAndConsts.json delete mode 100644 tests/RelOptRulesTest/testReduceCasts.json delete mode 100644 tests/RelOptRulesTest/testReduceCompositeInSubQuery.json delete mode 100644 tests/RelOptRulesTest/testReduceConstants.json delete mode 100644 tests/RelOptRulesTest/testReduceConstants3.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsCaseEquals.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsCaseEquals2.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsCaseEquals3.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsDup.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsDup2.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsDup3.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsDup3Null.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsDupNot.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsDupNot2.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsDupNot2Null.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsDupNotNull.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsEliminatesFilter.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsIsNotNull.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsIsNull.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsNegated.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsNegatedInverted.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsNull.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsNullEqualsOne.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsProjectNullable.json delete mode 100644 tests/RelOptRulesTest/testReduceConstantsRequiresExecutor.json delete mode 100644 tests/RelOptRulesTest/testReduceDynamic.json delete mode 100644 tests/RelOptRulesTest/testReduceNestedCaseWhen.json delete mode 100644 tests/RelOptRulesTest/testReduceNullableToNotNull.json delete mode 100644 tests/RelOptRulesTest/testReduceNullableToNotNull2.json delete mode 100644 tests/RelOptRulesTest/testReduceOrCaseWhen.json delete mode 100644 tests/RelOptRulesTest/testReduceValuesToEmpty.json delete mode 100644 tests/RelOptRulesTest/testReduceValuesUnderFilter.json delete mode 100644 tests/RelOptRulesTest/testReduceValuesUnderProject.json delete mode 100644 tests/RelOptRulesTest/testReduceValuesUnderProjectFilter.json delete mode 100644 tests/RelOptRulesTest/testReduceWithNonTypePredicate.json delete mode 100644 tests/RelOptRulesTest/testRemoveDistinctOnAgg.json delete mode 100644 tests/RelOptRulesTest/testRemoveSemiJoin.json delete mode 100644 tests/RelOptRulesTest/testRemoveSemiJoinRight.json delete mode 100644 tests/RelOptRulesTest/testRemoveSemiJoinRightWithFilter.json delete mode 100644 tests/RelOptRulesTest/testRemoveSemiJoinWithFilter.json delete mode 100644 tests/RelOptRulesTest/testRightEmptyAntiJoin.json delete mode 100644 tests/RelOptRulesTest/testRightEmptyAntiJoinNonEqui.json delete mode 100644 tests/RelOptRulesTest/testRightEmptyFullJoin.json delete mode 100644 tests/RelOptRulesTest/testRightEmptyInnerJoin.json delete mode 100644 tests/RelOptRulesTest/testRightEmptyLeftJoin.json delete mode 100644 tests/RelOptRulesTest/testRightEmptyRightJoin.json delete mode 100644 tests/RelOptRulesTest/testRightEmptySemiJoin.json delete mode 100644 tests/RelOptRulesTest/testRightOuterJoinSimplificationToInner.json delete mode 100644 tests/RelOptRulesTest/testSemiJoinProjectTranspose.json delete mode 100644 tests/RelOptRulesTest/testSemiJoinReduceConstants.json delete mode 100644 tests/RelOptRulesTest/testSemiJoinRule.json delete mode 100644 tests/RelOptRulesTest/testSemiJoinRuleExists.json delete mode 100644 tests/RelOptRulesTest/testSemiJoinRuleLeft.json delete mode 100644 tests/RelOptRulesTest/testSemiJoinRuleWithHint.json delete mode 100644 tests/RelOptRulesTest/testSemiJoinRuleWithJoinOnUniqueInput.json delete mode 100644 tests/RelOptRulesTest/testSemiJoinTrim.json delete mode 100644 tests/RelOptRulesTest/testSimplifyFilter.json delete mode 100644 tests/RelOptRulesTest/testSkipReduceConstantsCaseEquals.json delete mode 100644 tests/RelOptRulesTest/testSome.json delete mode 100644 tests/RelOptRulesTest/testSomeWithEquality.json delete mode 100644 tests/RelOptRulesTest/testSomeWithEquality2.json delete mode 100644 tests/RelOptRulesTest/testSomeWithNotEquality.json delete mode 100644 tests/RelOptRulesTest/testSortJoinCopyInnerJoinOrderBy.json delete mode 100644 tests/RelOptRulesTest/testSortJoinCopyInnerJoinOrderByLimit.json delete mode 100644 tests/RelOptRulesTest/testSortJoinCopyInnerJoinOrderByTwoFields.json delete mode 100644 tests/RelOptRulesTest/testSortJoinCopySemiJoinOrderBy.json delete mode 100644 tests/RelOptRulesTest/testSortJoinCopySemiJoinOrderByLimitOffset.json delete mode 100644 tests/RelOptRulesTest/testSortJoinCopySemiJoinOrderByOffset.json delete mode 100644 tests/RelOptRulesTest/testSortJoinTranspose1.json delete mode 100644 tests/RelOptRulesTest/testSortJoinTranspose2.json delete mode 100644 tests/RelOptRulesTest/testSortJoinTranspose4.json delete mode 100644 tests/RelOptRulesTest/testSortJoinTranspose6.json delete mode 100644 tests/RelOptRulesTest/testSortProjectTranspose1.json delete mode 100644 tests/RelOptRulesTest/testSortProjectTranspose2.json delete mode 100644 tests/RelOptRulesTest/testSortRemovalAllKeysConstant.json delete mode 100644 tests/RelOptRulesTest/testSortRemovalOneKeyConstant.json delete mode 100644 tests/RelOptRulesTest/testSortUnionTranspose.json delete mode 100644 tests/RelOptRulesTest/testSortUnionTranspose2.json delete mode 100644 tests/RelOptRulesTest/testSortUnionTranspose3.json delete mode 100644 tests/RelOptRulesTest/testSpatialContainsPoint.json delete mode 100644 tests/RelOptRulesTest/testSpatialDWithinLine.json delete mode 100644 tests/RelOptRulesTest/testSpatialDWithinReversed.json delete mode 100644 tests/RelOptRulesTest/testSpatialDWithinToHilbert.json delete mode 100644 tests/RelOptRulesTest/testSpatialDWithinToHilbertNegative.json delete mode 100644 tests/RelOptRulesTest/testSpatialDWithinToHilbertZero.json delete mode 100644 tests/RelOptRulesTest/testSpatialReduce.json delete mode 100644 tests/RelOptRulesTest/testStrengthenJoinType.json delete mode 100644 tests/RelOptRulesTest/testSumAndDistinctSumWithExpandSumType.json delete mode 100644 tests/RelOptRulesTest/testSwapOuterJoin.json delete mode 100644 tests/RelOptRulesTest/testTransitiveInferenceAggregate.json delete mode 100644 tests/RelOptRulesTest/testTransitiveInferenceComplexPredicate.json delete mode 100644 tests/RelOptRulesTest/testTransitiveInferenceConjunctInPullUp.json delete mode 100644 tests/RelOptRulesTest/testTransitiveInferenceJoin.json delete mode 100644 tests/RelOptRulesTest/testTransitiveInferenceJoin3way.json delete mode 100644 tests/RelOptRulesTest/testTransitiveInferenceJoin3wayAgg.json delete mode 100644 tests/RelOptRulesTest/testTransitiveInferenceLeftOuterJoin.json delete mode 100644 tests/RelOptRulesTest/testTransitiveInferenceProject.json delete mode 100644 tests/RelOptRulesTest/testTransitiveInferencePullUpThruAlias.json delete mode 100644 tests/RelOptRulesTest/testTransitiveInferenceRightOuterJoin.json delete mode 100644 tests/RelOptRulesTest/testTransitiveInferenceUnion.json delete mode 100644 tests/RelOptRulesTest/testTransitiveInferenceUnion3way.json delete mode 100644 tests/RelOptRulesTest/testTransitiveInferenceUnionAlwaysTrue.json delete mode 100644 tests/RelOptRulesTest/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json delete mode 100644 tests/RelOptRulesTest/testUnionMergeRule.json delete mode 100644 tests/RelOptRulesTest/testUnionToDistinctRule.json delete mode 100644 tests/RelOptRulesTest/testWhereAnyCorrelatedInSelect.json delete mode 100644 tests/RelOptRulesTest/testWhereExpressionInCorrelated.json delete mode 100644 tests/RelOptRulesTest/testWhereExpressionInCorrelated2.json delete mode 100644 tests/RelOptRulesTest/testWhereInCorrelated.json delete mode 100644 tests/RelOptRulesTest/testWhereInJoinCorrelated.json delete mode 100644 tests/RelOptRulesTest/testWhereNotInCorrelated.json delete mode 100644 tests/RelOptRulesTest/testWhereNotInCorrelated2.json delete mode 100644 tests/RelOptRulesTest/testWhereOrSubQuery.json delete mode 100644 tests/RelOptRulesTest/testWithinDistinct.json delete mode 100644 tests/RelOptRulesTest/testWithinDistinctCountDistinct.json delete mode 100644 tests/RelOptRulesTest/testWithinDistinctFilteredAggs.json delete mode 100644 tests/RelOptRulesTest/testWithinDistinctFilteredAggsSameFilter.json delete mode 100644 tests/RelOptRulesTest/testWithinDistinctFilteredAggsUniformDistinctKeys.json delete mode 100644 tests/RelOptRulesTest/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json delete mode 100644 tests/RelOptRulesTest/testWithinDistinctNoThrow.json delete mode 100644 tests/RelOptRulesTest/testWithinDistinctUniformDistinctKeys.json delete mode 100644 tests/RelOptRulesTest/testWithinDistinctUniformDistinctKeysNoThrow.json create mode 100644 tests/benchmark/testAddRedundantSemiJoinRule.json create mode 100644 tests/benchmark/testAggregateCaseToFilter.json create mode 100644 tests/benchmark/testAggregateConstantKeyRule.json create mode 100644 tests/benchmark/testAggregateConstantKeyRule3.json create mode 100644 tests/benchmark/testAggregateDynamicFunction.json create mode 100644 tests/benchmark/testAggregateExtractProjectRule.json create mode 100644 tests/benchmark/testAggregateExtractProjectRuleWithGroupingSets.json create mode 100644 tests/benchmark/testAggregateExtractProjectRuleWithGroupingSets2.json create mode 100644 tests/benchmark/testAggregateGroupingSetsProjectMerge.json create mode 100644 tests/benchmark/testAggregateJoinRemove1.json create mode 100644 tests/benchmark/testAggregateJoinRemove10.json create mode 100644 tests/benchmark/testAggregateJoinRemove11.json create mode 100644 tests/benchmark/testAggregateJoinRemove2.json create mode 100644 tests/benchmark/testAggregateJoinRemove3.json create mode 100644 tests/benchmark/testAggregateJoinRemove4.json create mode 100644 tests/benchmark/testAggregateJoinRemove5.json create mode 100644 tests/benchmark/testAggregateJoinRemove6.json create mode 100644 tests/benchmark/testAggregateJoinRemove7.json create mode 100644 tests/benchmark/testAggregateJoinRemove8.json create mode 100644 tests/benchmark/testAggregateJoinRemove9.json create mode 100644 tests/benchmark/testAggregateMerge1.json create mode 100644 tests/benchmark/testAggregateMerge2.json create mode 100644 tests/benchmark/testAggregateMerge8.json create mode 100644 tests/benchmark/testAggregateMergeSum0.json create mode 100644 tests/benchmark/testAggregateProjectMerge.json create mode 100644 tests/benchmark/testAggregateProjectPullUpConstants.json create mode 100644 tests/benchmark/testAggregateProjectPullUpConstants2.json create mode 100644 tests/benchmark/testAggregateRemove1.json create mode 100644 tests/benchmark/testAggregateRemove2.json create mode 100644 tests/benchmark/testAggregateRemove3.json create mode 100644 tests/benchmark/testAggregateRemove7.json create mode 100644 tests/benchmark/testAggregateUnionTransposeWithOneInputUnique.json create mode 100644 tests/benchmark/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json create mode 100644 tests/benchmark/testAll.json create mode 100644 tests/benchmark/testAlreadyFalseEliminatesFilter.json create mode 100644 tests/benchmark/testAntiJoinProjectTranspose.json create mode 100644 tests/benchmark/testAnyInProjectNonNullable.json create mode 100644 tests/benchmark/testAnyInProjectNullable.json create mode 100644 tests/benchmark/testBitAndReuseDistinctAttrWithMixedOptionality.json create mode 100644 tests/benchmark/testBitOrReuseDistinctAttrWithMixedOptionality.json create mode 100644 tests/benchmark/testCasePushIsAlwaysWorking.json create mode 100644 tests/benchmark/testCastInAggregateExpandDistinctAggregatesRule.json create mode 100644 tests/benchmark/testCastInAggregateReduceFunctions.json create mode 100644 tests/benchmark/testCustomColumnResolvingInCorrelatedSubQuery.json create mode 100644 tests/benchmark/testCustomColumnResolvingInCorrelatedSubQuery2.json create mode 100644 tests/benchmark/testCustomColumnResolvingInNonCorrelatedSubQuery.json create mode 100644 tests/benchmark/testDecorrelateAggWithConstantGroupKey.json create mode 100644 tests/benchmark/testDecorrelateExists.json create mode 100644 tests/benchmark/testDecorrelateTwoExists.json create mode 100644 tests/benchmark/testDecorrelateTwoIn.json create mode 100644 tests/benchmark/testDecorrelateUncorrelatedInAndCorrelatedExists.json create mode 100644 tests/benchmark/testDigestOfApproximateDistinctAggregateCall.json create mode 100644 tests/benchmark/testDistinctCount1.json create mode 100644 tests/benchmark/testDistinctCount2.json create mode 100644 tests/benchmark/testDistinctCount3.json create mode 100644 tests/benchmark/testDistinctCountGroupingSets1.json create mode 100644 tests/benchmark/testDistinctCountGroupingSets2.json create mode 100644 tests/benchmark/testDistinctCountMixed.json create mode 100644 tests/benchmark/testDistinctCountMixed2.json create mode 100644 tests/benchmark/testDistinctCountMixedJoin.json create mode 100644 tests/benchmark/testDistinctCountMultiple.json create mode 100644 tests/benchmark/testDistinctCountMultipleNoGroup.json create mode 100644 tests/benchmark/testDistinctCountMultipleViaJoin.json create mode 100644 tests/benchmark/testDistinctCountWithExpandSumType.json create mode 100644 tests/benchmark/testDistinctCountWithoutGroupBy.json create mode 100644 tests/benchmark/testDistinctNonDistinctAggregates.json create mode 100644 tests/benchmark/testDistinctNonDistinctAggregatesWithGrouping1.json create mode 100644 tests/benchmark/testDistinctNonDistinctAggregatesWithGrouping2.json create mode 100644 tests/benchmark/testDistinctNonDistinctTwoAggregatesWithGrouping.json create mode 100644 tests/benchmark/testDistinctWithDiffFiltersAndSameGroupSet.json create mode 100644 tests/benchmark/testDistinctWithFilterAndGroupBy.json create mode 100644 tests/benchmark/testDistinctWithFilterWithoutGroupBy.json create mode 100644 tests/benchmark/testDistinctWithGrouping.json create mode 100644 tests/benchmark/testDistinctWithMultipleInputs.json create mode 100644 tests/benchmark/testDistinctWithMultipleInputsAndGroupby.json create mode 100644 tests/benchmark/testEmptyAggregate.json create mode 100644 tests/benchmark/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json create mode 100644 tests/benchmark/testEmptyFilterProjectUnion.json create mode 100644 tests/benchmark/testEmptyIntersect.json create mode 100644 tests/benchmark/testEmptyMinus.json create mode 100644 tests/benchmark/testEmptyMinus2.json create mode 100644 tests/benchmark/testEmptyProject.json create mode 100644 tests/benchmark/testEmptyProject2.json create mode 100644 tests/benchmark/testEmptySort.json create mode 100644 tests/benchmark/testEmptySort2.json create mode 100644 tests/benchmark/testEmptySortLimitZero.json create mode 100644 tests/benchmark/testExistsWithAtLeastOneRowSubQuery.json create mode 100644 tests/benchmark/testExistsWithNoRowSubQuery.json create mode 100644 tests/benchmark/testExpandFilterExists.json create mode 100644 tests/benchmark/testExpandFilterExistsSimple.json create mode 100644 tests/benchmark/testExpandFilterExistsSimpleAnd.json create mode 100644 tests/benchmark/testExpandFilterIn.json create mode 100644 tests/benchmark/testExpandFilterIn3Value.json create mode 100644 tests/benchmark/testExpandFilterInComposite.json create mode 100644 tests/benchmark/testExpandFilterScalar.json create mode 100644 tests/benchmark/testExpandJoinExists.json create mode 100644 tests/benchmark/testExpandJoinScalar.json create mode 100644 tests/benchmark/testExpandProjectExists.json create mode 100644 tests/benchmark/testExpandProjectIn.json create mode 100644 tests/benchmark/testExpandProjectInComposite.json create mode 100644 tests/benchmark/testExpandProjectInNullable.json create mode 100644 tests/benchmark/testExpandProjectScalar.json create mode 100644 tests/benchmark/testExpandWhereComparisonCorrelated.json create mode 100644 tests/benchmark/testExpressionSimplification1.json create mode 100644 tests/benchmark/testExpressionSimplification2.json create mode 100644 tests/benchmark/testExtractJoinFilterRule.json create mode 100644 tests/benchmark/testExtractYearMonthToRange.json create mode 100644 tests/benchmark/testExtractYearToRange.json create mode 100644 tests/benchmark/testFilterJoinRuleAndIsNotNull.json create mode 100644 tests/benchmark/testFilterJoinRuleOrIsNotNull.json create mode 100644 tests/benchmark/testFilterProjectTranspose.json create mode 100644 tests/benchmark/testFilterRemoveIsNotDistinctFromRule.json create mode 100644 tests/benchmark/testFlattenUncorrelatedCallBelowEquals.json create mode 100644 tests/benchmark/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json create mode 100644 tests/benchmark/testFullOuterJoinSimplificationToInner.json create mode 100644 tests/benchmark/testFullOuterJoinSimplificationToLeftOuter.json create mode 100644 tests/benchmark/testFullOuterJoinSimplificationToRightOuter.json create mode 100644 tests/benchmark/testGroupByBooleanLiteralSimple.json create mode 100644 tests/benchmark/testGroupByDateLiteralSimple.json create mode 100644 tests/benchmark/testGroupByMultipleLiterals.json create mode 100644 tests/benchmark/testInferringPredicatesWithNotOperatorInJoinCondition.json create mode 100644 tests/benchmark/testIntersectToDistinct.json create mode 100644 tests/benchmark/testIsNullPushDown.json create mode 100644 tests/benchmark/testIsNullPushDown2.json create mode 100644 tests/benchmark/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json create mode 100644 tests/benchmark/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json create mode 100644 tests/benchmark/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json create mode 100644 tests/benchmark/testJoinConditionPushdown1.json create mode 100644 tests/benchmark/testJoinConditionPushdown2.json create mode 100644 tests/benchmark/testJoinConditionPushdown4.json create mode 100644 tests/benchmark/testJoinConditionPushdown6.json create mode 100644 tests/benchmark/testJoinDeriveIsNotNullFilterRule1.json create mode 100644 tests/benchmark/testJoinDeriveIsNotNullFilterRule12.json create mode 100644 tests/benchmark/testJoinDeriveIsNotNullFilterRule2.json create mode 100644 tests/benchmark/testJoinDeriveIsNotNullFilterRule3.json create mode 100644 tests/benchmark/testJoinDeriveIsNotNullFilterRule4.json create mode 100644 tests/benchmark/testJoinDeriveIsNotNullFilterRule5.json create mode 100644 tests/benchmark/testJoinProjectTranspose1.json create mode 100644 tests/benchmark/testJoinProjectTranspose7.json create mode 100644 tests/benchmark/testJoinProjectTranspose8.json create mode 100644 tests/benchmark/testJoinProjectTransposeWindow.json create mode 100644 tests/benchmark/testJoinPushTransitivePredicatesRule2.json create mode 100644 tests/benchmark/testLeftEmptyAntiJoin.json create mode 100644 tests/benchmark/testLeftEmptyFullJoin.json create mode 100644 tests/benchmark/testLeftEmptyInnerJoin.json create mode 100644 tests/benchmark/testLeftEmptyLeftJoin.json create mode 100644 tests/benchmark/testLeftEmptyRightJoin.json create mode 100644 tests/benchmark/testLeftEmptySemiJoin.json create mode 100644 tests/benchmark/testLeftOuterJoinSimplificationToInner.json create mode 100644 tests/benchmark/testMaxReuseDistinctAttrWithMixedOptionality.json create mode 100644 tests/benchmark/testMergeFilter.json create mode 100644 tests/benchmark/testMergeIntersect.json create mode 100644 tests/benchmark/testMergeJoinFilter.json create mode 100644 tests/benchmark/testMergeMinus.json create mode 100644 tests/benchmark/testMergeUnionAll.json create mode 100644 tests/benchmark/testMergeUnionDistinct.json create mode 100644 tests/benchmark/testMergeUnionMixed2.json create mode 100644 tests/benchmark/testMinReuseDistinctAttrWithMixedOptionality.json create mode 100644 tests/benchmark/testMinusMergeRule.json create mode 100644 tests/benchmark/testMultipleDistinctWithGrouping.json create mode 100644 tests/benchmark/testNoOversimplificationBelowIsNull.json create mode 100644 tests/benchmark/testOrAlwaysTrue.json create mode 100644 tests/benchmark/testOrAlwaysTrue2.json create mode 100644 tests/benchmark/testOversimplifiedCaseStatement.json create mode 100644 tests/benchmark/testProjectAggregateMerge.json create mode 100644 tests/benchmark/testProjectAggregateMergeSum0.json create mode 100644 tests/benchmark/testProjectAggregateMergeSum0AndSum.json create mode 100644 tests/benchmark/testProjectCorrelateTransposeRuleLeftCorrelate.json create mode 100644 tests/benchmark/testProjectJoinRemove1.json create mode 100644 tests/benchmark/testProjectJoinRemove10.json create mode 100644 tests/benchmark/testProjectJoinRemove4.json create mode 100644 tests/benchmark/testProjectJoinRemove7.json create mode 100644 tests/benchmark/testProjectJoinTransposeItem.json create mode 100644 tests/benchmark/testProjectSetOpTranspose.json create mode 100644 tests/benchmark/testPullAggregateThroughUnion.json create mode 100644 tests/benchmark/testPullAggregateThroughUnion2.json create mode 100644 tests/benchmark/testPullAggregateThroughUnionAndAddProjects.json create mode 100644 tests/benchmark/testPullAggregateThroughUnionWithAlias.json create mode 100644 tests/benchmark/testPullConstantIntoFilter.json create mode 100644 tests/benchmark/testPullConstantIntoJoin.json create mode 100644 tests/benchmark/testPullConstantIntoJoin2.json create mode 100644 tests/benchmark/testPullConstantIntoProject.json create mode 100644 tests/benchmark/testPullConstantIntoProjectWithIsNotDistinctFrom.json create mode 100644 tests/benchmark/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json create mode 100644 tests/benchmark/testPullConstantThroughAggregateAllConst.json create mode 100644 tests/benchmark/testPullConstantThroughAggregateAllLiterals.json create mode 100644 tests/benchmark/testPullConstantThroughAggregateConstGroupBy.json create mode 100644 tests/benchmark/testPullConstantThroughAggregatePermuted.json create mode 100644 tests/benchmark/testPullConstantThroughAggregatePermutedConstFirst.json create mode 100644 tests/benchmark/testPullConstantThroughAggregatePermutedConstGroupBy.json create mode 100644 tests/benchmark/testPullConstantThroughAggregateSimpleNonNullable.json create mode 100644 tests/benchmark/testPullConstantThroughConstLast.json create mode 100644 tests/benchmark/testPullConstantThroughUnion.json create mode 100644 tests/benchmark/testPullConstantThroughUnion3.json create mode 100644 tests/benchmark/testPullFilterThroughAggregate.json create mode 100644 tests/benchmark/testPullFilterThroughAggregateGroupingSets.json create mode 100644 tests/benchmark/testPullNull.json create mode 100644 tests/benchmark/testPushAboveFiltersIntoInnerJoinCondition.json create mode 100644 tests/benchmark/testPushAggregateFunctionsThroughJoin.json create mode 100644 tests/benchmark/testPushAggregateSumNoGroup.json create mode 100644 tests/benchmark/testPushAggregateSumThroughJoin.json create mode 100644 tests/benchmark/testPushAggregateSumThroughJoinAfterAggregateReduce.json create mode 100644 tests/benchmark/testPushAggregateSumWithoutGroupKeyThroughJoin.json create mode 100644 tests/benchmark/testPushAggregateThroughJoin1.json create mode 100644 tests/benchmark/testPushAggregateThroughJoin2.json create mode 100644 tests/benchmark/testPushAggregateThroughJoin4.json create mode 100644 tests/benchmark/testPushAggregateThroughJoin5.json create mode 100644 tests/benchmark/testPushAggregateThroughJoin6.json create mode 100644 tests/benchmark/testPushAggregateThroughJoin7.json create mode 100644 tests/benchmark/testPushAggregateThroughJoin8.json create mode 100644 tests/benchmark/testPushAggregateThroughJoinDistinct.json create mode 100644 tests/benchmark/testPushAggregateThroughJoinOnEmptyLogicalValues.json create mode 100644 tests/benchmark/testPushAggregateThroughJoinWithUniqueInput.json create mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin1.json create mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin12.json create mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin13.json create mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin14.json create mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin15.json create mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin16.json create mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin2.json create mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin3.json create mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin4.json create mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin5.json create mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin6.json create mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin7.json create mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin8.json create mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin9.json create mode 100644 tests/benchmark/testPushAvgGroupingSetsThroughUnion.json create mode 100644 tests/benchmark/testPushAvgThroughUnion.json create mode 100644 tests/benchmark/testPushBoolAndBoolOrThroughUnion.json create mode 100644 tests/benchmark/testPushCountFilterThroughUnion.json create mode 100644 tests/benchmark/testPushCountNullableGroupingSetsThroughUnion.json create mode 100644 tests/benchmark/testPushCountNullableThroughUnion.json create mode 100644 tests/benchmark/testPushCountStarGroupingSetsThroughUnion.json create mode 100644 tests/benchmark/testPushCountStarThroughUnion.json create mode 100644 tests/benchmark/testPushFilterPastAgg.json create mode 100644 tests/benchmark/testPushFilterPastAggFour.json create mode 100644 tests/benchmark/testPushFilterPastAggTwo.json create mode 100644 tests/benchmark/testPushFilterPastAggWithGroupingSets2.json create mode 100644 tests/benchmark/testPushFilterPastProject.json create mode 100644 tests/benchmark/testPushFilterSemijoin.json create mode 100644 tests/benchmark/testPushFilterThroughSemiJoin.json create mode 100644 tests/benchmark/testPushFilterWithIsNotDistinctFromPastJoin.json create mode 100644 tests/benchmark/testPushJoinCondDownToProject.json create mode 100644 tests/benchmark/testPushJoinThroughUnionOnLeft.json create mode 100644 tests/benchmark/testPushJoinThroughUnionOnRight.json create mode 100644 tests/benchmark/testPushMaxNullableGroupingSetsThroughUnion.json create mode 100644 tests/benchmark/testPushMaxNullableThroughUnion.json create mode 100644 tests/benchmark/testPushMinGroupingSetsThroughUnion.json create mode 100644 tests/benchmark/testPushMinThroughUnion.json create mode 100644 tests/benchmark/testPushProjectPastFilter.json create mode 100644 tests/benchmark/testPushProjectPastFilter2.json create mode 100644 tests/benchmark/testPushProjectPastFilter3b.json create mode 100644 tests/benchmark/testPushProjectPastFilter3c.json create mode 100644 tests/benchmark/testPushProjectPastFullJoin.json create mode 100644 tests/benchmark/testPushProjectPastFullJoinStrong.json create mode 100644 tests/benchmark/testPushProjectPastInnerJoin.json create mode 100644 tests/benchmark/testPushProjectPastInnerJoinStrong.json create mode 100644 tests/benchmark/testPushProjectPastJoin.json create mode 100644 tests/benchmark/testPushProjectPastLeftJoin.json create mode 100644 tests/benchmark/testPushProjectPastLeftJoinSwap.json create mode 100644 tests/benchmark/testPushProjectPastLeftJoinSwapStrong.json create mode 100644 tests/benchmark/testPushProjectPastRightJoin.json create mode 100644 tests/benchmark/testPushProjectPastRightJoinStrong.json create mode 100644 tests/benchmark/testPushProjectPastRightJoinSwap.json create mode 100644 tests/benchmark/testPushProjectPastRightJoinSwapStrong.json create mode 100644 tests/benchmark/testPushProjectPastSetOp.json create mode 100644 tests/benchmark/testPushProjectWithIsNotDistinctFromPastJoin.json create mode 100644 tests/benchmark/testPushProjectWithOverPastJoin1.json create mode 100644 tests/benchmark/testPushProjectWithOverPastJoin2.json create mode 100644 tests/benchmark/testPushProjectWithOverPastJoin3.json create mode 100644 tests/benchmark/testPushSemiJoinConditions.json create mode 100644 tests/benchmark/testPushSemiJoinPastFilter.json create mode 100644 tests/benchmark/testPushSemiJoinPastJoinRuleLeft.json create mode 100644 tests/benchmark/testPushSemiJoinPastJoinRuleRight.json create mode 100644 tests/benchmark/testPushSemiJoinPastProject.json create mode 100644 tests/benchmark/testPushSumConstantGroupingSetsThroughUnion.json create mode 100644 tests/benchmark/testPushSumConstantThroughUnion.json create mode 100644 tests/benchmark/testPushSumCountStarGroupingSetsThroughUnion.json create mode 100644 tests/benchmark/testPushSumCountStarThroughUnion.json create mode 100644 tests/benchmark/testPushSumNullConstantGroupingSetsThroughUnion.json create mode 100644 tests/benchmark/testPushSumNullConstantThroughUnion.json create mode 100644 tests/benchmark/testPushSumNullableGroupingSetsThroughUnion.json create mode 100644 tests/benchmark/testPushSumNullableNOGBYThroughUnion.json create mode 100644 tests/benchmark/testPushSumNullableThroughUnion.json create mode 100644 tests/benchmark/testReduceAggregateFunctionsByGroup.json create mode 100644 tests/benchmark/testReduceAllAggregateFunctions.json create mode 100644 tests/benchmark/testReduceAverage.json create mode 100644 tests/benchmark/testReduceAverageAndSumWithNoReduceStddevAndVar.json create mode 100644 tests/benchmark/testReduceAverageAndVarWithNoReduceStddev.json create mode 100644 tests/benchmark/testReduceAverageWithNoReduceSum.json create mode 100644 tests/benchmark/testReduceCase.json create mode 100644 tests/benchmark/testReduceCaseNullabilityChange.json create mode 100644 tests/benchmark/testReduceCastAndConsts.json create mode 100644 tests/benchmark/testReduceCasts.json create mode 100644 tests/benchmark/testReduceCompositeInSubQuery.json create mode 100644 tests/benchmark/testReduceConstants.json create mode 100644 tests/benchmark/testReduceConstants3.json create mode 100644 tests/benchmark/testReduceConstantsCaseEquals.json create mode 100644 tests/benchmark/testReduceConstantsCaseEquals2.json create mode 100644 tests/benchmark/testReduceConstantsCaseEquals3.json create mode 100644 tests/benchmark/testReduceConstantsDup.json create mode 100644 tests/benchmark/testReduceConstantsDup2.json create mode 100644 tests/benchmark/testReduceConstantsDup3.json create mode 100644 tests/benchmark/testReduceConstantsDup3Null.json create mode 100644 tests/benchmark/testReduceConstantsDupNot.json create mode 100644 tests/benchmark/testReduceConstantsDupNot2.json create mode 100644 tests/benchmark/testReduceConstantsDupNot2Null.json create mode 100644 tests/benchmark/testReduceConstantsDupNotNull.json create mode 100644 tests/benchmark/testReduceConstantsEliminatesFilter.json create mode 100644 tests/benchmark/testReduceConstantsIsNotNull.json create mode 100644 tests/benchmark/testReduceConstantsIsNull.json create mode 100644 tests/benchmark/testReduceConstantsNegated.json create mode 100644 tests/benchmark/testReduceConstantsNegatedInverted.json create mode 100644 tests/benchmark/testReduceConstantsNull.json create mode 100644 tests/benchmark/testReduceConstantsNullEqualsOne.json create mode 100644 tests/benchmark/testReduceConstantsProjectNullable.json create mode 100644 tests/benchmark/testReduceConstantsRequiresExecutor.json create mode 100644 tests/benchmark/testReduceDynamic.json create mode 100644 tests/benchmark/testReduceNestedCaseWhen.json create mode 100644 tests/benchmark/testReduceNullableToNotNull.json create mode 100644 tests/benchmark/testReduceNullableToNotNull2.json create mode 100644 tests/benchmark/testReduceOrCaseWhen.json create mode 100644 tests/benchmark/testReduceValuesToEmpty.json create mode 100644 tests/benchmark/testReduceValuesUnderFilter.json create mode 100644 tests/benchmark/testReduceValuesUnderProject.json create mode 100644 tests/benchmark/testReduceValuesUnderProjectFilter.json create mode 100644 tests/benchmark/testReduceWithNonTypePredicate.json create mode 100644 tests/benchmark/testRemoveDistinctOnAgg.json create mode 100644 tests/benchmark/testRemoveSemiJoin.json create mode 100644 tests/benchmark/testRemoveSemiJoinRight.json create mode 100644 tests/benchmark/testRemoveSemiJoinRightWithFilter.json create mode 100644 tests/benchmark/testRemoveSemiJoinWithFilter.json create mode 100644 tests/benchmark/testRightEmptyAntiJoin.json create mode 100644 tests/benchmark/testRightEmptyAntiJoinNonEqui.json create mode 100644 tests/benchmark/testRightEmptyFullJoin.json create mode 100644 tests/benchmark/testRightEmptyInnerJoin.json create mode 100644 tests/benchmark/testRightEmptyLeftJoin.json create mode 100644 tests/benchmark/testRightEmptyRightJoin.json create mode 100644 tests/benchmark/testRightEmptySemiJoin.json create mode 100644 tests/benchmark/testRightOuterJoinSimplificationToInner.json create mode 100644 tests/benchmark/testSemiJoinProjectTranspose.json create mode 100644 tests/benchmark/testSemiJoinReduceConstants.json create mode 100644 tests/benchmark/testSemiJoinRule.json create mode 100644 tests/benchmark/testSemiJoinRuleExists.json create mode 100644 tests/benchmark/testSemiJoinRuleLeft.json create mode 100644 tests/benchmark/testSemiJoinRuleWithHint.json create mode 100644 tests/benchmark/testSemiJoinRuleWithJoinOnUniqueInput.json create mode 100644 tests/benchmark/testSemiJoinTrim.json create mode 100644 tests/benchmark/testSimplifyFilter.json create mode 100644 tests/benchmark/testSkipReduceConstantsCaseEquals.json create mode 100644 tests/benchmark/testSome.json create mode 100644 tests/benchmark/testSomeWithEquality.json create mode 100644 tests/benchmark/testSomeWithEquality2.json create mode 100644 tests/benchmark/testSomeWithNotEquality.json create mode 100644 tests/benchmark/testSortJoinCopyInnerJoinOrderBy.json create mode 100644 tests/benchmark/testSortJoinCopyInnerJoinOrderByLimit.json create mode 100644 tests/benchmark/testSortJoinCopyInnerJoinOrderByTwoFields.json create mode 100644 tests/benchmark/testSortJoinCopySemiJoinOrderBy.json create mode 100644 tests/benchmark/testSortJoinCopySemiJoinOrderByLimitOffset.json create mode 100644 tests/benchmark/testSortJoinCopySemiJoinOrderByOffset.json create mode 100644 tests/benchmark/testSortJoinTranspose1.json create mode 100644 tests/benchmark/testSortJoinTranspose2.json create mode 100644 tests/benchmark/testSortJoinTranspose4.json create mode 100644 tests/benchmark/testSortJoinTranspose6.json create mode 100644 tests/benchmark/testSortProjectTranspose1.json create mode 100644 tests/benchmark/testSortProjectTranspose2.json create mode 100644 tests/benchmark/testSortRemovalAllKeysConstant.json create mode 100644 tests/benchmark/testSortRemovalOneKeyConstant.json create mode 100644 tests/benchmark/testSortUnionTranspose.json create mode 100644 tests/benchmark/testSortUnionTranspose2.json create mode 100644 tests/benchmark/testSortUnionTranspose3.json create mode 100644 tests/benchmark/testSpatialContainsPoint.json create mode 100644 tests/benchmark/testSpatialDWithinLine.json create mode 100644 tests/benchmark/testSpatialDWithinReversed.json create mode 100644 tests/benchmark/testSpatialDWithinToHilbert.json create mode 100644 tests/benchmark/testSpatialDWithinToHilbertNegative.json create mode 100644 tests/benchmark/testSpatialDWithinToHilbertZero.json create mode 100644 tests/benchmark/testSpatialReduce.json create mode 100644 tests/benchmark/testStrengthenJoinType.json create mode 100644 tests/benchmark/testSumAndDistinctSumWithExpandSumType.json create mode 100644 tests/benchmark/testSwapOuterJoin.json create mode 100644 tests/benchmark/testTransitiveInferenceAggregate.json create mode 100644 tests/benchmark/testTransitiveInferenceComplexPredicate.json create mode 100644 tests/benchmark/testTransitiveInferenceConjunctInPullUp.json create mode 100644 tests/benchmark/testTransitiveInferenceJoin.json create mode 100644 tests/benchmark/testTransitiveInferenceJoin3way.json create mode 100644 tests/benchmark/testTransitiveInferenceJoin3wayAgg.json create mode 100644 tests/benchmark/testTransitiveInferenceLeftOuterJoin.json create mode 100644 tests/benchmark/testTransitiveInferenceProject.json create mode 100644 tests/benchmark/testTransitiveInferencePullUpThruAlias.json create mode 100644 tests/benchmark/testTransitiveInferenceRightOuterJoin.json create mode 100644 tests/benchmark/testTransitiveInferenceUnion.json create mode 100644 tests/benchmark/testTransitiveInferenceUnion3way.json create mode 100644 tests/benchmark/testTransitiveInferenceUnionAlwaysTrue.json create mode 100644 tests/benchmark/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json create mode 100644 tests/benchmark/testUnionMergeRule.json create mode 100644 tests/benchmark/testUnionToDistinctRule.json create mode 100644 tests/benchmark/testWhereAnyCorrelatedInSelect.json create mode 100644 tests/benchmark/testWhereExpressionInCorrelated.json create mode 100644 tests/benchmark/testWhereExpressionInCorrelated2.json create mode 100644 tests/benchmark/testWhereInCorrelated.json create mode 100644 tests/benchmark/testWhereInJoinCorrelated.json create mode 100644 tests/benchmark/testWhereNotInCorrelated.json create mode 100644 tests/benchmark/testWhereNotInCorrelated2.json create mode 100644 tests/benchmark/testWhereOrSubQuery.json create mode 100644 tests/benchmark/testWithinDistinct.json create mode 100644 tests/benchmark/testWithinDistinctCountDistinct.json create mode 100644 tests/benchmark/testWithinDistinctFilteredAggs.json create mode 100644 tests/benchmark/testWithinDistinctFilteredAggsSameFilter.json create mode 100644 tests/benchmark/testWithinDistinctFilteredAggsUniformDistinctKeys.json create mode 100644 tests/benchmark/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json create mode 100644 tests/benchmark/testWithinDistinctNoThrow.json create mode 100644 tests/benchmark/testWithinDistinctUniformDistinctKeys.json create mode 100644 tests/benchmark/testWithinDistinctUniformDistinctKeysNoThrow.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b287112..efb5041 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v18 + - uses: cachix/install-nix-action@v20 with: nix_path: nixpkgs=channel:nixos-unstable - uses: cachix/cachix-action@v12 diff --git a/Cargo.lock b/Cargo.lock index f833bf2..bf66588 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,18 +4,18 @@ version = 3 [[package]] name = "aho-corasick" -version = "0.7.19" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" dependencies = [ "memchr", ] [[package]] name = "anyhow" -version = "1.0.64" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9a8f622bcf6ff3df478e9deba3e03e4e04b300f8e6a139e192c05fa3490afc7" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" [[package]] name = "atty" @@ -36,9 +36,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "bimap" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc0455254eb5c6964c4545d8bac815e1a1be4f3afe0ae695ea539c12d728d44b" +checksum = "230c5f1ca6a325a32553f8640d31ac9b49f2411e901e427570154868b46da4f7" [[package]] name = "bindgen" @@ -88,9 +88,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clang-sys" -version = "1.3.3" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a050e2153c5be08febd6734e29298e844fdb0fa21aeddd63b4eb7baa106c69b" +checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" dependencies = [ "glob", "libc", @@ -114,6 +114,7 @@ dependencies = [ "permutation", "scopeguard", "serde", + "serde-enum-str", "serde_json", "walkdir", "z3", @@ -135,9 +136,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.6" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ "cfg-if", "crossbeam-utils", @@ -145,9 +146,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -156,23 +157,22 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.10" +version = "0.9.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "045ebe27666471bb549370b4b0b3e51b07f56325befa4284db65fc89c02511b1" +checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", "memoffset", - "once_cell", "scopeguard", ] [[package]] name = "crossbeam-queue" -version = "0.3.6" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd42583b04998a5363558e5f9291ee5a5ff6b49944332103f251e7479a82aa7" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" dependencies = [ "cfg-if", "crossbeam-utils", @@ -180,25 +180,58 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.11" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" +checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" dependencies = [ "cfg-if", - "once_cell", +] + +[[package]] +name = "darling" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "darling_macro" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" +dependencies = [ + "darling_core", + "quote", + "syn 1.0.109", ] [[package]] name = "either" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "env_logger" -version = "0.9.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" dependencies = [ "atty", "humantime", @@ -207,11 +240,17 @@ dependencies = [ "termcolor", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "glob" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "hermit-abi" @@ -228,6 +267,12 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "imbl" version = "2.0.1" @@ -266,18 +311,18 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.3" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.3" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "lazy_static" @@ -293,15 +338,15 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.132" +version = "0.2.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" +checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" [[package]] name = "libloading" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" dependencies = [ "cfg-if", "winapi", @@ -324,9 +369,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" -version = "0.6.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" dependencies = [ "autocfg", ] @@ -339,9 +384,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "nom" -version = "7.1.1" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", @@ -374,9 +419,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" +checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" dependencies = [ "num-traits", ] @@ -423,17 +468,11 @@ dependencies = [ "autocfg", ] -[[package]] -name = "once_cell" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0" - [[package]] name = "paste" -version = "1.0.9" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" +checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" [[package]] name = "peeking_take_while" @@ -449,27 +488,27 @@ checksum = "d9978962f8a4b158e97447a6d09d2d75e206d2994eff056c894019f362b27142" [[package]] name = "proc-macro2" -version = "1.0.43" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.21" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ "proc-macro2", ] [[package]] name = "rand_core" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" [[package]] name = "rand_xoshiro" @@ -482,9 +521,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.6.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" dependencies = [ "aho-corasick", "memchr", @@ -493,9 +532,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.27" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" [[package]] name = "rustc-hash" @@ -505,9 +544,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "same-file" @@ -526,29 +565,59 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.144" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" +checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" dependencies = [ "serde_derive", ] +[[package]] +name = "serde-attributes" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eb8ec7724e4e524b2492b510e66957fe1a2c76c26a6975ec80823f2439da685" +dependencies = [ + "darling_core", + "serde-rename-rule", + "syn 1.0.109", +] + +[[package]] +name = "serde-enum-str" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d862bd95a79912e4f0e3312720a3d89348b314095aa3f20751ca2e483ae68b20" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "serde-attributes", + "syn 1.0.109", +] + +[[package]] +name = "serde-rename-rule" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "794e44574226fc701e3be5c651feb7939038fc67fb73f6f4dd5c4ba90fd3be70" + [[package]] name = "serde_derive" -version = "1.0.144" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" +checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] name = "serde_json" -version = "1.0.85" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" +checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" dependencies = [ "itoa", "ryu", @@ -563,9 +632,20 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "syn" -version = "1.0.99" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" +checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" dependencies = [ "proc-macro2", "quote", @@ -574,18 +654,18 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] [[package]] name = "unicode-ident" -version = "1.0.3" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" [[package]] name = "version_check" @@ -595,12 +675,11 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.3.2" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" dependencies = [ "same-file", - "winapi", "winapi-util", ] @@ -638,7 +717,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "z3" version = "0.11.2" -source = "git+https://github.com/wsx-ucb/z3.rs?branch=add-binding#5c0c18f778db015dc6c7f2219bb2fee617f24747" +source = "git+https://github.com/wsx-ucb/z3.rs?branch=add-binding#f9766a713a8da6a7f6c3e21ff5179a55b0527501" dependencies = [ "log", "z3-sys", @@ -647,7 +726,7 @@ dependencies = [ [[package]] name = "z3-sys" version = "0.7.1" -source = "git+https://github.com/wsx-ucb/z3.rs?branch=add-binding#5c0c18f778db015dc6c7f2219bb2fee617f24747" +source = "git+https://github.com/wsx-ucb/z3.rs?branch=add-binding#f9766a713a8da6a7f6c3e21ff5179a55b0527501" dependencies = [ "bindgen", ] diff --git a/Cargo.toml b/Cargo.toml index 863e03a..7a410b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ edition = "2018" [dependencies] walkdir = "2" serde = { version = "1.0", features = ["derive"] } +serde-enum-str = "0.3" serde_json = "1.0" z3 = { git = "https://github.com/wsx-ucb/z3.rs", branch = "add-binding" } scopeguard = "1.1" diff --git a/flake.lock b/flake.lock index f332542..811e65d 100644 --- a/flake.lock +++ b/flake.lock @@ -12,11 +12,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1672804365, - "narHash": "sha256-1Bh6//eesTHQRDWlzA+PjVPfwsFoftGHTYgZekIzZLg=", + "lastModified": 1681680516, + "narHash": "sha256-EB8Adaeg4zgcYDJn9sR6UMjN/OHdIiMMK19+3LmmXQY=", "owner": "ipetkov", "repo": "crane", - "rev": "cc20f29b4ae0d4c6e13e01f08b2d9072b09b04e7", + "rev": "54b63c8eae4c50172cb50b612946ff1d2bc1c75c", "type": "github" }, "original": { @@ -33,11 +33,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1672726921, - "narHash": "sha256-KgH9AbM+eTC0GfVT5vfL9smNHSY858m8j4c9J1NOYfM=", + "lastModified": 1682230876, + "narHash": "sha256-vCnd1pZRQKCdNvivQBD7WzaOlU1GcN91OCAz1rnoe5M=", "owner": "nix-community", "repo": "fenix", - "rev": "54cb27afc034071551f239975fd58a68fc55c953", + "rev": "378f052d9f1cd90060ec4329f81782fee80490a4", "type": "github" }, "original": { @@ -49,11 +49,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1668681692, - "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "owner": "edolstra", "repo": "flake-compat", - "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "type": "github" }, "original": { @@ -63,12 +63,15 @@ } }, "flake-utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { @@ -79,11 +82,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1672756850, - "narHash": "sha256-Smbq3+fitwA13qsTMeaaurv09/KVbZfW7m7lINwzDGA=", + "lastModified": 1682109806, + "narHash": "sha256-d9g7RKNShMLboTWwukM+RObDWWpHKaqTYXB48clBWXI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "298add347c2bbce14020fcb54051f517c391196b", + "rev": "2362848adf8def2866fabbffc50462e929d7fffb", "type": "github" }, "original": { @@ -104,11 +107,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1672697831, - "narHash": "sha256-ocCIR907dCzSpLLLQwB8yVbmK7IFT2aJsndQovoGI1Y=", + "lastModified": 1682163822, + "narHash": "sha256-u7vaRlI6rYiutytoTk8lyOtNKO/rz5Q63Z6S6QzYCtU=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "e75e2f83689d1591749b032b79c682c6d15c2424", + "rev": "2feabc4dc462644287372922928110eea4c60ca7", "type": "github" }, "original": { @@ -130,11 +133,11 @@ ] }, "locked": { - "lastModified": 1670034122, - "narHash": "sha256-EqmuOKucPWtMvCZtHraHr3Q3bgVszq1x2PoZtQkUuEk=", + "lastModified": 1680488274, + "narHash": "sha256-0vYMrZDdokVmPQQXtFpnqA2wEgCCUXf5a3dDuDVshn0=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "a0d5773275ecd4f141d792d3a0376277c0fc0b65", + "rev": "7ec2ff598a172c6e8584457167575b3a1a5d80d8", "type": "github" }, "original": { @@ -142,6 +145,21 @@ "repo": "rust-overlay", "type": "github" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index e436e3b..4ffdf41 100644 --- a/flake.nix +++ b/flake.nix @@ -20,17 +20,17 @@ let pkgs = nixpkgs.legacyPackages.${system}; # Switch to nightly toolchain - craneLib = crane.lib.${system}.overrideToolchain fenix.packages.${system}.minimal.toolchain; + craneLib = crane.lib.${system}.overrideToolchain fenix.packages.${system}.complete.toolchain; packageDef = with pkgs; { src = craneLib.cleanCargoSource ./.; - buildInputs = with pkgs; [ z3 ]; + buildInputs = with pkgs; [ z3_4_11 cvc5 ]; nativeBuildInputs = with pkgs; [ rustPlatform.bindgenHook makeWrapper ] ++ lib.optionals stdenv.isDarwin [ libiconv ]; }; cargoArtifacts = craneLib.buildDepsOnly packageDef; cosette-prover = craneLib.buildPackage (packageDef // { inherit cargoArtifacts; - postInstall = with pkgs; "wrapProgram $out/bin/cosette-prover --prefix PATH : ${cvc5}/bin"; + postInstall = with pkgs; "wrapProgram $out/bin/cosette-prover --set PATH ${lib.makeBinPath [ cvc5 z3_4_11 ]}"; }); in { packages.default = cosette-prover; diff --git a/src/main.rs b/src/main.rs index af0e997..2254534 100644 --- a/src/main.rs +++ b/src/main.rs @@ -88,7 +88,8 @@ fn main() -> io::Result<()> { "{}\n{}", matches!(result, CosetteResult::Provable), duration.as_secs_f32() - ); + ) + .unwrap(); stats.insert(path.to_string_lossy().to_string(), result); })?; } diff --git a/src/pipeline/normal.rs b/src/pipeline/normal.rs index 4501fc9..0e2a850 100644 --- a/src/pipeline/normal.rs +++ b/src/pipeline/normal.rs @@ -20,11 +20,9 @@ use crate::pipeline::{partial, shared}; pub type Relation = Lambda; -pub type Expr = shared::Expr; -pub type Neutral = shared::Neutral; -#[derive(Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)] -pub struct LogicRel(pub Vector, pub Box); -pub type Logic = shared::Logic; +pub type Expr = shared::Expr; +pub type Neutral = shared::Neutral; +pub type Logic = shared::Logic; pub type UExpr = Terms; @@ -47,14 +45,6 @@ impl Term { } } -impl Display for LogicRel { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - writeln!(f, "{:?} {{", self.0)?; - writeln!(indented(f).with_str("\t"), "{}", self.1)?; - write!(f, "}}") - } -} - impl Display for Term { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { writeln!(f, "∑ {:?} {{", self.scope)?; @@ -73,6 +63,7 @@ impl Expr { match self { Expr::Var(v, _) if vars.contains(&v.0) => HashSet::unit(*v), Expr::Var(_, _) => HashSet::new(), + Expr::Log(l) => l.deps(vars), Expr::Op(_, args, _) => HashSet::unions(args.iter().map(|arg| arg.deps(vars))), Expr::HOp(_, args, rel, _) => { HashSet::unions(args.iter().map(|arg| arg.deps(vars))) + rel.deps(vars) @@ -83,22 +74,54 @@ impl Expr { pub(crate) fn in_scope(&self, lvl: usize) -> bool { match self { Expr::Var(VL(l), _) => *l < lvl, + Expr::Log(l) => l.in_scope(lvl), Expr::Op(_, args, _) => args.iter().all(|arg| arg.in_scope(lvl)), Expr::HOp(_, args, rel, _) => { args.iter().all(|arg| arg.in_scope(lvl)) && rel.in_scope(lvl) }, } } + + pub(crate) fn exprs(&self) -> Vector<&Expr> { + match self { + Expr::Log(l) => l.exprs(), + Expr::Op(op, es, ty) if op == "=" && es.len() == 2 && ty == &DataType::Boolean => { + es.iter().collect() + }, + Expr::Op(_, es, _) | Expr::HOp(_, es, _, _) => { + es.iter().flat_map(Expr::exprs).collect() + }, + _ => vector![], + } + } +} + +impl UExpr { + fn deps(&self, vars: &Range) -> HashSet { + HashSet::unions(self.iter().map(|t| t.deps(vars))) + } + + fn in_scope(&self, lvl: usize) -> bool { + self.iter().all(|t| t.in_scope(lvl)) + } + + pub(crate) fn exprs(&self) -> Vector<&Expr> { + self.iter().flat_map(Term::exprs).collect() + } } impl Relation { fn deps(&self, vars: &Range) -> HashSet { - HashSet::unions(self.1.iter().map(|t| t.deps(vars))) + self.1.deps(vars) } fn in_scope(&self, lvl: usize) -> bool { let Lambda(scope, body) = self; - body.iter().all(|t| t.in_scope(lvl + scope.len())) + body.in_scope(lvl + scope.len()) + } + + pub(crate) fn exprs(&self) -> Vector<&Expr> { + self.1.exprs() } } @@ -111,6 +134,10 @@ impl Term { let lvl = lvl + self.scope.len(); self.logic.in_scope(lvl) && self.apps.iter().all(|app| app.in_scope(lvl)) } + + pub(crate) fn exprs(&self) -> Vector<&Expr> { + self.logic.exprs() + self.apps.iter().flat_map(Neutral::exprs).collect() + } } impl Neutral { @@ -131,6 +158,15 @@ impl Neutral { }, }) && self.args.iter().all(|arg| arg.in_scope(lvl)) } + + pub(crate) fn exprs(&self) -> Vector<&Expr> { + (match &self.head { + Head::Var(_) => vector![], + Head::HOp(_, args, rel) => { + args.iter().flat_map(Expr::exprs).chain(rel.exprs()).collect() + }, + }) + self.args.iter().flat_map(Expr::exprs).collect() + } } impl Logic { @@ -142,8 +178,8 @@ impl Logic { Pred(_, args) => HashSet::unions(args.iter().map(|arg| arg.deps(vars))), Neg(l) => l.deps(vars), And(ls) | Or(ls) => HashSet::unions(ls.iter().map(|l| l.deps(vars))), - App(app) => app.deps(vars), - Exists(LogicRel(_, l)) => l.deps(vars), + Squash(u) => u.deps(vars), + Exists(rel) => rel.deps(vars), } } @@ -155,50 +191,22 @@ impl Logic { Pred(_, args) => args.iter().all(|arg| arg.in_scope(lvl)), Neg(l) => l.in_scope(lvl), And(ls) | Or(ls) => ls.iter().all(|l| l.in_scope(lvl)), - App(app) => app.in_scope(lvl), - Exists(LogicRel(scope, l)) => l.in_scope(lvl + scope.len()), + Squash(u) => u.in_scope(lvl), + Exists(rel) => rel.in_scope(lvl), } } - fn is_tt(&self) -> bool { + pub(crate) fn exprs(&self) -> Vector<&Expr> { use shared::Logic::*; match self { - Eq(e1, e2) if e1 == e2 => true, - And(ls) if ls.is_empty() => true, - Neg(l) if l.is_ff() => true, - _ => false, - } - } - - fn is_ff(&self) -> bool { - use shared::Logic::*; - match self { - Or(ls) if ls.is_empty() => true, - Neg(l) if l.is_tt() => true, - _ => false, - } - } - - fn norm(self) -> Logic { - use shared::Logic::*; - match self { - l if l.is_tt() => Logic::tt(), - l if l.is_ff() => Logic::ff(), - And(ls) => { - let ls = ls.into_iter().flat_map(|l| match l { - And(ls) => ls, - l => vector![l], - }); - And(ls.collect()) - }, - Or(ls) => { - let ls = ls.into_iter().flat_map(|l| match l { - Or(ls) => ls, - l => vector![l], - }); - Or(ls.collect()) - }, - l => l, + Bool(e) => e.exprs(), + Pred(_, es) => es.iter().flat_map(Expr::exprs).collect(), + Eq(e1, e2) => vector![e1, e2] + e1.exprs() + e2.exprs(), + Neg(l) => l.exprs(), + And(ls) => ls.iter().flat_map(Logic::exprs).collect(), + Or(ls) => ls.iter().flat_map(Logic::exprs).collect(), + Squash(u) => u.exprs(), + Exists(Lambda(_, u)) => u.exprs(), } } } @@ -241,39 +249,6 @@ fn helper(env: &Env, mut term: partial::Term, apps: Vector) -> } } -impl Eval for &Env { - fn eval(self, app: partial::Neutral) -> Logic { - match app.head.app_logic(app.args, self) { - Either::Left(app) => Logic::App(self.eval(app)), - Either::Right(logic) => self.eval(logic), - } - } -} - -impl Eval for &Env { - fn eval(self, source: partial::LogicRel) -> LogicRel { - use partial::LogicRel::*; - let Env(context, schemas) = self; - let scope = source.scope(schemas); - let env = &self.extend(scope.clone()); - let vars = shared::Expr::vars(context.len(), scope.clone()); - LogicRel( - scope, - Box::new(match source { - Rigid(head) => match head.app_logic(vars, env) { - Either::Left(app) => env.eval(app), - Either::Right(logic) => env.eval(logic), - }, - Lam(scope, clos_env, body) => { - let vars = shared::Expr::vars(context.len(), scope.clone()); - let body: partial::Logic = (&clos_env.append(vars)).eval(body); - env.eval(body) - }, - }), - ) - } -} - impl Eval<(VL, DataType), Expr> for &Env { fn eval(self, source: (VL, DataType)) -> Expr { Expr::Var(source.0, source.1) @@ -325,32 +300,6 @@ impl<'c> Eval, Term> for &Env { } } -impl<'c> Eval, Logic> for &Env { - fn eval(self, source: stable::Logic<'c>) -> Logic { - use shared::Logic::*; - match source { - Bool(e) => Bool(self.eval(e)), - Eq(e1, e2) => Eq(self.eval(e1), self.eval(e2)), - Pred(p, args) => Pred(p, self.eval(args)), - Neg(l) => Neg(self.eval(l)), - And(ls) => And(self.eval(ls)), - Or(ls) => Or(self.eval(ls)), - App(app) => self.eval(app), - Exists(stable::LogicRel(scope, env, body)) => { - let body = (&env.extend(self.0.len(), scope.clone())).eval(body); - Exists(LogicRel(scope.clone(), Box::new((&self.extend(scope)).eval(body)))) - }, - } - .norm() - } -} - -impl<'c> Eval, Logic> for &Env { - fn eval(self, source: stable::Neutral<'c>) -> Logic { - Logic::App(self.eval(source)) - } -} - impl Unify for &Env { fn unify(self, t1: partial::UExpr, t2: partial::UExpr) -> bool { let Env(context, _) = self; @@ -393,6 +342,10 @@ impl<'c> Z3Env<'c> { Z3Env(self.0.clone(), self.1.clone() + vars, self.2.clone(), self.3.clone()) } + pub fn extend_vals(&self, vals: &Vector>) -> Self { + Z3Env(self.0.clone(), &self.1 + vals, self.2.clone(), self.3.clone()) + } + pub fn extend_vars(&self, scope: &Vector) -> (Z3Env<'c>, Vector>) { let vars = scope.into_iter().map(|ty| self.0.var(ty, "v")).collect(); (Z3Env(self.0.clone(), &self.1 + &vars, self.2.clone(), self.3.clone()), vars) @@ -406,7 +359,10 @@ impl<'c> Eval<&Logic, Bool<'c>> for &Z3Env<'c> { let z3_ctx = ctx.z3_ctx(); match source { Bool(e) => self.0.bool_is_true(&self.eval(e)), - Eq(e1, e2) => self.eval(e1)._eq(&self.eval(e2)), + Eq(e1, e2) => { + assert_eq!(e1.ty(), e2.ty(), "{} and {} have different types", e1, e2); + self.eval(e1)._eq(&self.eval(e2)) + }, Pred(p, args) => { let args = args.iter().map(|arg| self.eval(arg)).collect_vec(); let args = args.iter().collect_vec(); @@ -415,13 +371,38 @@ impl<'c> Eval<&Logic, Bool<'c>> for &Z3Env<'c> { Neg(l) => self.eval(l.as_ref()).not(), And(ls) => z3::ast::Bool::and(z3_ctx, &self.eval(ls).iter().collect_vec()), Or(ls) => z3::ast::Bool::or(z3_ctx, &self.eval(ls).iter().collect_vec()), - App(app) => self.eval(app), - Exists(LogicRel(scope, l)) => { - let (ref env, vars) = self.clone().extend_vars(&scope); - let bounds = vars.iter().map(|v| v as &dyn Ast).collect_vec(); - let body = env.eval(l.as_ref()); - exists_const(z3_ctx, &bounds, &[], &body) - }, + Squash(u) => self.eval(u.as_ref()), + Exists(Lambda(scope, l)) => self.eval(&UExpr::under(scope.clone(), l.clone())), + } + } +} + +impl<'c> Eval<&UExpr, Bool<'c>> for &Z3Env<'c> { + fn eval(self, source: &UExpr) -> Bool<'c> { + let terms = source.iter().map(|t| self.eval(t)).collect_vec(); + Bool::or(self.0.z3_ctx(), &terms.iter().collect_vec()) + } +} + +impl<'c> Eval<&Term, Bool<'c>> for &Z3Env<'c> { + fn eval(self, source: &Term) -> Bool<'c> { + let z3_ctx = self.0.z3_ctx(); + let (ref env, vars) = self.extend_vars(&source.scope); + let logic = env.eval(&source.logic); + let apps = env.eval(&source.apps); + let bounds = vars.iter().map(|v| v as &dyn Ast).collect_vec(); + exists_const(z3_ctx, &bounds, &[], &Bool::and(z3_ctx, &[&logic, &apps])) + } +} + +impl<'c> Eval<&Vector, Bool<'c>> for &Z3Env<'c> { + fn eval(self, source: &Vector) -> Bool<'c> { + let apps: Vector<_> = self.eval(source); + let z3_ctx = self.0.z3_ctx(); + if apps.is_empty() { + Bool::from_bool(z3_ctx, true) + } else { + Bool::and(z3_ctx, &apps.iter().collect_vec()) } } } @@ -438,7 +419,12 @@ impl<'c> Eval<&Vector, Int<'c>> for &Z3Env<'c> { } } -fn table_name(head: &Head, env: &Z3Env, squashed: bool, domain: Vec) -> String { +fn table_name( + head: &Head, + env: &Z3Env, + squashed: bool, + domain: Vec, +) -> String { let Z3Env(_, subst, _, map) = env; match head { Head::Var(VL(l)) => format!("r{}!{}", if squashed { "p" } else { "" }, l), @@ -517,7 +503,9 @@ impl<'c> Eval<&Expr, Dynamic<'c>> for &Z3Env<'c> { }; match source { Expr::Var(v, _) => subst[v.0].clone(), - Expr::Op(op, args, ty) if args.is_empty() => parse(ctx.as_ref(), op, ty).unwrap(), + Expr::Log(l) => ctx.bool_some(self.eval(l.as_ref())), + Expr::Op(op, args, ty) if args.is_empty() => parse(ctx.as_ref(), op, ty) + .unwrap_or_else(|_| ctx.app(&format!("f!{}", op), &[], ty, true)), Expr::Op(op, expr_args, ty) => { let args = expr_args.iter().map(|a| self.eval(a)).collect_vec(); let args = args.iter().collect_vec(); @@ -555,8 +543,23 @@ impl<'c> Eval<&Expr, Dynamic<'c>> for &Z3Env<'c> { "<=" => ctx.real_le(args[0], args[1]), _ => unreachable!(), }, - "=" => ctx.bool_some(args[0]._eq(args[1])), - "<>" => ctx.bool_some(args[0]._eq(args[1]).not()), + // "=" => ctx.bool_some(args[0]._eq(args[1])), + // "<>" | "!=" => ctx.bool_some(args[0]._eq(args[1]).not()), + cmp @ ("=" | "<>" | "!=") => { + let (a1, a2) = (args[0], args[1]); + assert_eq!(a1.get_sort(), a2.get_sort(), "{} and {} have different types.", expr_args[0], expr_args[1]); + let eq = match expr_args[0].ty() { + Integer => ctx.int__eq(a1, a2), + Real => ctx.real__eq(a1, a2), + Boolean => ctx.bool__eq(a1, a2), + String => ctx.string__eq(a1, a2), + Custom(_) => todo!("Cannot compare between arbitrary types yet."), + }; + if cmp == "=" { eq } else { ctx.bool_not(&eq) } + } + "NOT" if args.len() == 1 => ctx.bool_not(args[0]), + "AND" => ctx.bool_and_v(&args), + "OR" => ctx.bool_or_v(&args), "CASE" if args.len() % 2 == 1 => { let (chunks, remainder) = args.as_chunks(); chunks.iter().rfold(remainder[0].clone(), |rem, [cond, body]| { @@ -578,6 +581,28 @@ impl<'c> Eval<&Expr, Dynamic<'c>> for &Z3Env<'c> { op => ctx.app(&format!("f!{}", op), &args, ty, true), } }, + Expr::HOp(f, args, rel, DataType::Boolean) if f == "IN" => { + let z3_ctx = ctx.z3_ctx(); + let (is_nulls, args, nulls): (Vec<_>, _, _) = args + .iter() + .map(|a| { + let null = ctx.none(&a.ty()).unwrap(); + let a = self.eval(a); + (null._eq(&a), a, null) + }) + .multiunzip(); + let Lambda(_, uexpr) = *rel.clone(); + let any_null = Bool::or(z3_ctx, &is_nulls.iter().collect_vec()); + any_null.ite( + &ctx.bool_none(), + &(&self.extend_vals(&args)).eval(&uexpr).ite( + &ctx.bool_some(Bool::from_bool(z3_ctx, true)), + &(&self.extend_vals(&nulls)) + .eval(&uexpr) + .ite(&ctx.bool_none(), &ctx.bool_some(Bool::from_bool(z3_ctx, false))), + ), + ) + }, Expr::HOp(f, args, rel, ty) => h_ops .borrow_mut() .entry((f.clone(), args.clone(), *rel.clone(), subst.clone())) diff --git a/src/pipeline/null.rs b/src/pipeline/null.rs index 5bbbac5..66e4ec8 100644 --- a/src/pipeline/null.rs +++ b/src/pipeline/null.rs @@ -59,7 +59,10 @@ macro_rules! optional_op { macro_rules! optional_fn { ($ilsort:ident $olsort:ident $name:ident ($($v:ident),* $(,)*)) => { - paste!(pub fn [<$ilsort _ $name>] (&self, $($v: &Dynamic<'c>),*) -> Dynamic<'c> { + paste!( + #[allow(non_snake_case)] + #[allow(dead_code)] + pub fn [<$ilsort _ $name>] (&self, $($v: &Dynamic<'c>),*) -> Dynamic<'c> { let input_sort = &self.$ilsort.sort; let output_sort = &self.$olsort.sort; let func = FuncDecl::new( @@ -121,6 +124,7 @@ ctx_impl!( le(x, y) -> Bool; gt(x, y) -> Bool; ge(x, y) -> Bool; + _eq(x, y) -> Bool; }; Int { add[a, b] -> Int; @@ -135,18 +139,21 @@ ctx_impl!( le(x, y) -> Bool; gt(x, y) -> Bool; ge(x, y) -> Bool; + _eq(x, y) -> Bool; to_real(x) -> Real; }; Bool { not(x) -> Bool; - and[x, y] -> Bool; - or[x, y] -> Bool; + // and[x, y] -> Bool; + // or[x, y] -> Bool; + _eq(x, y) -> Bool; }; String { concat[x, y] -> String; contains(x, y) -> Bool; prefix(x, y) -> Bool; suffix(x, y) -> Bool; + _eq(x, y) -> Bool; }; ); @@ -202,4 +209,68 @@ impl<'c> Ctx<'c> { ._eq(&Bool::from_bool(ctx, true).into()), ) } + + pub fn bool_and_v(&self, args: &[&Dynamic<'c>]) -> Dynamic<'c> { + args.iter() + .fold(self.bool_some(Bool::from_bool(self.solver.get_context(), true)), |a, b| { + self.bool_and(&a, b) + }) + } + + pub fn bool_or_v(&self, args: &[&Dynamic<'c>]) -> Dynamic<'c> { + args.iter() + .fold(self.bool_some(Bool::from_bool(self.solver.get_context(), false)), |a, b| { + self.bool_or(&a, b) + }) + } + + pub fn bool_and(&self, e1: &Dynamic<'c>, e2: &Dynamic<'c>) -> Dynamic<'c> { + let ctx = self.solver.get_context(); + self.bool.variants[0].tester.apply(&[e1]).as_bool().unwrap().ite( + // NULL, b + &self.bool.variants[0].tester.apply(&[e2]).as_bool().unwrap().ite( + // NULL, NULL + &e2, + // NULL, Some(b) + &self.bool.variants[1].accessors[0].apply(&[e2]).as_bool().unwrap().ite( + // NULL, Some(True) + &self.bool_none(), + // NULL, Some(False) + &e2, + ), + ), + // Some(a), b + &self.bool.variants[1].accessors[0].apply(&[e1]).as_bool().unwrap().ite( + // Some(True), b + &e2, + // Some(False), b + &self.bool_some(Bool::from_bool(ctx, false)), + ), + ) + } + + pub fn bool_or(&self, e1: &Dynamic<'c>, e2: &Dynamic<'c>) -> Dynamic<'c> { + let ctx = self.solver.get_context(); + self.bool.variants[0].tester.apply(&[e1]).as_bool().unwrap().ite( + // NULL, b + &self.bool.variants[0].tester.apply(&[e2]).as_bool().unwrap().ite( + // NULL, NULL + &e2, + // NULL, Some(b) + &self.bool.variants[1].accessors[0].apply(&[e2]).as_bool().unwrap().ite( + // NULL, Some(True) + &e2, + // NULL, Some(False) + &self.bool_none(), + ), + ), + // Some(a), b + &self.bool.variants[1].accessors[0].apply(&[e1]).as_bool().unwrap().ite( + // Some(True), b + &self.bool_some(Bool::from_bool(ctx, true)), + // Some(False), b + &e2, + ), + ) + } } diff --git a/src/pipeline/partial.rs b/src/pipeline/partial.rs index 22cf1e3..fefed46 100644 --- a/src/pipeline/partial.rs +++ b/src/pipeline/partial.rs @@ -8,10 +8,10 @@ use crate::pipeline::shared::{DataType, Eval, Terms, VL}; use crate::pipeline::unify::Unify; use crate::pipeline::{normal, shared, syntax}; -pub type Expr = shared::Expr; -pub type Head = shared::Head; -pub type Neutral = shared::Neutral; -pub type Logic = shared::Logic; +pub type Expr = shared::Expr; +pub type Head = shared::Head; +pub type Neutral = shared::Neutral; +pub type Logic = shared::Logic; impl Head { pub fn app(self, args: Vector, env: &normal::Env) -> Either { @@ -29,22 +29,6 @@ impl Head { _ => Either::Left(Neutral::new(self, args)), } } - - pub fn app_logic(self, args: Vector, env: &normal::Env) -> Either { - use shared::Head::*; - match self { - HOp(op, args, _) if op == "limit" && args[0] == 0u32.into() => { - Either::Right(Logic::ff()) - }, - HOp(op, h_args, rel) - if ((op == "limit" && h_args[0] == 1u32.into()) && rel.degen(env)) - || (op == "offset" && h_args[0] == 0u32.into()) => - { - Either::Right(rel.app_logic(args)) - }, - _ => Either::Left(Neutral::new(self, args)), - } - } } #[derive(Debug, Clone, Eq, PartialEq)] @@ -53,23 +37,6 @@ pub enum Relation { Lam(Vector, Env, syntax::UExpr), } -#[derive(Debug, Clone, Eq, PartialEq)] -pub enum LogicRel { - Rigid(Head), - Lam(Vector, Env, syntax::Logic), -} - -impl LogicRel { - pub fn scope(&self, schemas: &Vector) -> Vector { - use LogicRel::*; - match self { - Rigid(Head::Var(l)) => schemas[l.0].types.clone().into(), - Rigid(Head::HOp(_, _, rel)) => rel.scope(schemas), - Lam(scopes, _, _) => scopes.clone(), - } - } -} - impl Relation { pub fn app(self, args: Vector) -> UExpr { use Relation::*; @@ -79,14 +46,6 @@ impl Relation { } } - pub fn app_logic(self, args: Vector) -> Logic { - use Relation::*; - match self { - Rigid(head) => Logic::App(Neutral::new(head, args)), - Lam(_, env, body) => (&env.append(args)).eval(body.as_logic()), - } - } - pub fn scope(&self, schemas: &Vector) -> Vector { use Relation::*; match self { @@ -97,12 +56,7 @@ impl Relation { } fn degen(&self, env: &normal::Env) -> bool { - use Relation::*; - let lrel = match self.clone() { - Rigid(head) => LogicRel::Rigid(head), - Lam(scope, env, body) => LogicRel::Lam(scope, env, body.as_logic()), - }; - env.unify(UExpr::sum(self.clone()), UExpr::logic(Logic::Exists(lrel))) + env.unify(UExpr::sum(self.clone()), UExpr::logic(Logic::Exists(self.clone()))) } } @@ -166,7 +120,8 @@ impl Eval for &Env { match source { Add(us) => us.into_iter().flat_map(|u| self.eval(u)).collect(), Mul(us) => us.into_iter().map(|u| self.eval(u)).fold(UExpr::one(), UExpr::mul), - u @ (Squash(_) | Not(_)) => UExpr::logic(self.eval(u.as_logic())), + Squash(u) => UExpr::logic(Logic::squash(self.eval(*u))), + Not(u) => UExpr::logic(!Logic::squash(self.eval(*u))), Sum(scopes, body) => UExpr::sum(Relation::Lam(scopes, self.clone(), *body)), Pred(logic) => UExpr::logic(self.eval(logic)), App(table, args) => { @@ -177,21 +132,6 @@ impl Eval for &Env { } } -impl Eval for &Env { - fn eval(self, syntax::Application(table, args): syntax::Application) -> Logic { - use syntax::Relation::*; - let args = self.eval(args); - match table { - Var(l) => Logic::App(Neutral::new(Head::Var(l), args)), - Lam(_, body) => (&self.append(args)).eval(body.as_logic()), - HOp(op, hop_args, rel) => { - let head = Head::HOp(op, self.eval(hop_args), self.eval(rel)); - Logic::App(Neutral::new(head, args)) - }, - } - } -} - impl Eval<(VL, DataType), Expr> for &Env { fn eval(self, (VL(l), ty): (VL, DataType)) -> Expr { assert_eq!(self.0[l].ty(), ty, "Wrong type for {}", VL(l)); @@ -211,16 +151,3 @@ impl Eval for &Env { } } } - -impl Eval for &Env { - fn eval(self, source: syntax::Relation) -> LogicRel { - use syntax::Relation::*; - match source { - Var(t) => LogicRel::Rigid(Head::Var(t)), - HOp(name, args, rel) => { - LogicRel::Rigid(Head::HOp(name, self.eval(args), self.eval(rel))) - }, - Lam(scopes, body) => LogicRel::Lam(scopes, self.clone(), body.as_logic()), - } - } -} diff --git a/src/pipeline/relation.rs b/src/pipeline/relation.rs index 5e6a458..71e2d9f 100644 --- a/src/pipeline/relation.rs +++ b/src/pipeline/relation.rs @@ -56,9 +56,9 @@ pub enum Relation { kind: JoinKind, }, Correlate(Box, Box), - Union(Box, Box), + Union(Vec), + Intersect(Vec), Except(Box, Box), - Intersect(Box, Box), Distinct(Box), Values { schema: Vec, @@ -84,17 +84,14 @@ impl Relation { Singleton => Vector::new(), Scan(table) => schemas[table.0].types.clone().into(), Filter { source, .. } => source.scope(schemas), - Project { columns, .. } => { - columns.iter().map(|expr| expr.ty()).collect() - }, - Aggregate { columns, .. } => { - columns.iter().map(|agg| agg.ty.clone()).collect() - } + Project { columns, .. } => columns.iter().map(|expr| expr.ty()).collect(), + Aggregate { columns, .. } => columns.iter().map(|agg| agg.ty.clone()).collect(), Join { left, kind: JoinKind::Semi | JoinKind::Anti, .. } => left.scope(schemas), Join { left, right, .. } | Correlate(left, right) => { left.scope(schemas) + right.scope(schemas) }, - Union(rel1, _) | Except(rel1, _) | Intersect(rel1, _) => rel1.scope(schemas), + Union(rels) | Intersect(rels) => rels[0].scope(schemas), + Except(rel1, _) => rel1.scope(schemas), Distinct(rel) => rel.scope(schemas), Values { schema, .. } => schema.clone().into(), Sort { source, .. } => source.scope(schemas), @@ -260,21 +257,29 @@ impl Eval for Env<'_> { }, // R(x) union all S(y) // λx. R(x) + S(x) - Union(left, right) => { + Union(sources) => { let body_lvl = lvl + scopes.len(); let vars = vars(lvl, scopes.clone()); - let left = Env(schemas, subst, body_lvl).eval(*left); - let right = Env(schemas, subst, body_lvl).eval(*right); - Rel::lam(scopes, UExpr::App(left, vars.clone()) + UExpr::App(right, vars)) + let sum = sources + .into_iter() + .map(|source| { + UExpr::App(Env(schemas, subst, body_lvl).eval(source), vars.clone()) + }) + .collect(); + Rel::lam(scopes, UExpr::Add(sum)) }, // R(x) intersect S(y) // λx. ‖R(x) × S(x)‖ - Intersect(left, right) => { + Intersect(sources) => { let body_lvl = lvl + scopes.len(); let vars = vars(lvl, scopes.clone()); - let left = Env(schemas, subst, body_lvl).eval(*left); - let right = Env(schemas, subst, body_lvl).eval(*right); - Rel::lam(scopes, UExpr::squash(UExpr::App(left, vars.clone()) * UExpr::App(right, vars))) + let prod = sources + .into_iter() + .map(|source| { + UExpr::App(Env(schemas, subst, body_lvl).eval(source), vars.clone()) + }) + .collect(); + Rel::lam(scopes, UExpr::squash(UExpr::Mul(prod))) }, // R(x) except S(y) // λx. ‖R(x) × ¬S(x)‖ @@ -283,7 +288,10 @@ impl Eval for Env<'_> { let vars = vars(lvl, scopes.clone()); let left = Env(schemas, subst, body_lvl).eval(*left); let right = Env(schemas, subst, body_lvl).eval(*right); - Rel::lam(scopes, UExpr::squash(UExpr::App(left, vars.clone()) * !UExpr::App(right, vars))) + Rel::lam( + scopes, + UExpr::squash(UExpr::App(left, vars.clone()) * !UExpr::App(right, vars)), + ) }, // Distinct R(x) // λx. ‖R(x)‖ @@ -352,12 +360,22 @@ pub struct AggCall { op: String, #[serde(rename = "operand")] args: Vec, + #[serde(default = "default_distinct")] distinct: bool, + #[serde(default = "default_ignore_nulls")] ignore_nulls: bool, #[serde(alias = "type")] ty: DataType, } +fn default_distinct() -> bool { + false +} + +fn default_ignore_nulls() -> bool { + true +} + impl Eval<(AggCall, Relation), syntax::Expr> for Env<'_> { fn eval(self, (agg, rel): (AggCall, Relation)) -> syntax::Expr { let tys = agg.args.iter().map(|arg| arg.ty()).collect_vec(); @@ -368,16 +386,16 @@ impl Eval<(AggCall, Relation), syntax::Expr> for Env<'_> { }; let source = if agg.distinct { Relation::Distinct(source.into()) } else { source }; let source = if agg.ignore_nulls { - let conditions = tys.into_iter().enumerate().map(|(i, ty)| Expr::Op { - op: "IS NOT NULL".into(), - args: vec![Expr::Col { column: VL(i), ty }], - ty: DataType::Boolean, - }).collect_vec(); - let condition = Expr::Op { - op: "AND".into(), - args: conditions, - ty: DataType::Boolean, - }; + let conditions = tys + .into_iter() + .enumerate() + .map(|(i, ty)| Expr::Op { + op: "IS NOT NULL".into(), + args: vec![Expr::Col { column: VL(i), ty }], + ty: DataType::Boolean, + }) + .collect_vec(); + let condition = Expr::Op { op: "AND".into(), args: conditions, ty: DataType::Boolean }; Relation::Filter { condition, source: source.into() } } else { source @@ -446,6 +464,7 @@ impl Eval for Env<'_> { if cast { args.into_iter().map(Expr::into_real).collect() } else { args }; Op(op, self.eval(args), ty) }, + Expr::HOp { ref op, .. } if op == "EXISTS" => Log(Box::new(self.eval(source))), Expr::HOp { op, args, rel, ty } => HOp(op, self.eval(args), self.eval(rel), ty), } } @@ -457,22 +476,21 @@ impl Eval for Env<'_> { Expr::Op { op, args, ty: DataType::Boolean } => match op.to_uppercase().as_str() { "TRUE" => Logic::tt(), "FALSE" => Logic::ff(), - "=" if args.iter().any(|a| a.ty() == DataType::Real) => { + "<=>" => Logic::Eq(self.eval(args[0].clone()), self.eval(args[1].clone())), + "=" | "<>" | "!=" if args.iter().any(|a| a.ty() == DataType::Real) => { let args = args.into_iter().map(Expr::into_real).collect_vec(); - Logic::Eq(self.eval(args[0].clone()), self.eval(args[1].clone())) + Logic::Bool(self.eval(Expr::Op { op, args, ty: DataType::Boolean })) }, - "=" => Logic::Eq(self.eval(args[0].clone()), self.eval(args[1].clone())), - "<>" => !Logic::Eq(self.eval(args[0].clone()), self.eval(args[1].clone())), "AND" => Logic::And(args.into_iter().map(|arg| self.eval(arg)).collect()), "OR" => Logic::Or(args.into_iter().map(|arg| self.eval(arg)).collect()), - "NOT" => Logic::not(self.eval(args[0].clone())), + // "NOT" => Logic::not(self.eval(args[0].clone())), "IS NULL" => Logic::is_null(self.eval(args[0].clone())), "IS NOT NULL" => !Logic::is_null(self.eval(args[0].clone())), _ => Logic::Bool(self.eval(source)), }, Expr::Col { ty: DataType::Boolean, .. } => Logic::Bool(self.eval(source)), Expr::HOp { op, args, rel, ty: DataType::Boolean } => match op.as_str() { - "IN" => Logic::App(syntax::Application(self.eval(*rel), self.eval(args).into())), + // "IN" => Logic::squash(UExpr::App(self.eval(*rel), self.eval(args).into())), "EXISTS" => Logic::Exists(self.eval(*rel)), _ => Logic::Bool(self.eval(source)), }, diff --git a/src/pipeline/shared.rs b/src/pipeline/shared.rs index b705377..46554f6 100644 --- a/src/pipeline/shared.rs +++ b/src/pipeline/shared.rs @@ -11,6 +11,7 @@ use imbl::{vector, Vector}; use indenter::indented; use itertools::Itertools; use serde::{Deserialize, Serialize}; +use serde_enum_str::{Deserialize_enum_str, Serialize_enum_str}; use z3::ast::{Ast, Datatype, Dynamic}; use z3::{Context, FuncDecl, Sort}; @@ -44,10 +45,11 @@ pub struct Schema { } #[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] -pub enum Expr { +pub enum Expr { Var(VL, DataType), - Op(String, Vec>, DataType), - HOp(String, Vec>, Box, DataType), + Log(Box>), + Op(String, Vec>, DataType), + HOp(String, Vec>, Box, DataType), } #[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] @@ -61,18 +63,18 @@ impl Display for Lambda { } #[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] -pub enum Logic { - Bool(Expr), - Eq(Expr, Expr), - Pred(String, Vec>), - Neg(Box>), - And(Vector>), - Or(Vector>), - App(A), - Exists(L), -} - -impl Logic { +pub enum Logic { + Bool(Expr), + Eq(Expr, Expr), + Pred(String, Vec>), + Neg(Box>), + And(Vector>), + Or(Vector>), + Squash(Box), + Exists(R), +} + +impl Logic { pub fn tt() -> Self { Logic::And(vector![]) } @@ -81,13 +83,17 @@ impl Logic { Logic::Or(vector![]) } - pub fn is_null(expr: Expr) -> Self { + pub fn is_null(expr: Expr) -> Self { let ty = expr.ty(); Self::Eq(expr, Expr::Op("NULL".to_string(), vec![], ty)) } + + pub fn squash(uexpr: impl Into>) -> Self { + Self::Squash(uexpr.into()) + } } -impl Mul for Logic { +impl Mul for Logic { type Output = Self; fn mul(self, rhs: Self) -> Self::Output { @@ -101,7 +107,7 @@ impl Mul for Logic { } } -impl Add for Logic { +impl Add for Logic { type Output = Self; fn add(self, rhs: Self) -> Self::Output { @@ -115,7 +121,7 @@ impl Add for Logic { } } -impl Not for Logic { +impl Not for Logic { type Output = Self; fn not(self) -> Self::Output { @@ -123,7 +129,7 @@ impl Not for Logic { } } -impl Display for Logic { +impl Display for Logic { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { use Logic::*; match self { @@ -135,23 +141,21 @@ impl Display for Logic { And(ls) => write!(f, "({})", ls.iter().format(" ∧ ")), Or(ls) if ls.is_empty() => write!(f, "false"), Or(ls) => write!(f, "({})", ls.iter().format(" ∨ ")), - App(app) => write!(f, "{}", app), + Squash(u) => write!(f, "{}", u), Exists(rel) => write!(f, "∃({})", rel), } } } -impl Eval, Logic> for E +impl Eval, Logic> for E where - E: Eval, Expr> + Eval + Eval> + Clone, + E: Eval, Expr> + Eval + Eval + Clone, S: Clone, T: Clone, - L: Clone, - M: Clone, - A: Clone, - B: Clone, + U: Clone, + V: Clone, { - fn eval(self, source: Logic) -> Logic { + fn eval(self, source: Logic) -> Logic { use Logic::*; match source { Bool(e) => Bool(self.eval(e)), @@ -160,31 +164,33 @@ where Neg(l) => Neg(self.eval(l)), And(ls) => And(self.eval(ls)), Or(ls) => Or(self.eval(ls)), - App(app) => self.eval(app), + Squash(u) => Squash(self.eval(u)), Exists(rel) => Exists(self.eval(rel)), } } } -impl Expr { +impl Expr { pub fn ty(&self) -> DataType { use Expr::*; match self { Var(_, ty) | Op(_, _, ty) | HOp(_, _, _, ty) => ty.clone(), + Log(_) => DataType::Boolean, } } } -impl Expr { - pub fn vars(level: usize, scopes: Vector) -> Vector> { - scopes.into_iter().enumerate().map(|(l, ty)| Expr::::Var(VL(level + l), ty)).collect() +impl Expr { + pub fn vars(level: usize, scopes: Vector) -> Vector> { + scopes.into_iter().enumerate().map(|(l, ty)| Expr::Var(VL(level + l), ty)).collect() } } -impl Display for Expr { +impl Display for Expr { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { Expr::Var(v, _) => write!(f, "{}", v), + Expr::Log(u) => write!(f, "‖{}‖", u), Expr::Op(op, args, _) if args.is_empty() => write!(f, "\"{}\"", op), Expr::Op(op, args, _) => { write!(f, "{}({})", op, args.iter().join(", ")) @@ -194,41 +200,47 @@ impl Display for Expr { } } -impl From for Expr { +impl From for Expr { fn from(n: u32) -> Self { Expr::Op(n.to_string(), vec![], DataType::Integer) } } -impl From for Expr { +impl From for Expr { fn from(n: usize) -> Self { Expr::Op(n.to_string(), vec![], DataType::Integer) } } -impl From for Expr { +impl From for Expr { fn from(s: String) -> Self { Expr::Op(s, vec![], DataType::String) } } -impl Eval, Expr> for E -where E: Eval<(VL, DataType), Expr> + Eval + Clone +impl Eval, Expr> for E +where + E: Eval<(VL, DataType), Expr> + Eval + Eval + Clone, + S: Clone, + T: Clone, + U: Clone, + V: Clone, { - fn eval(self, source: Expr) -> Expr { + fn eval(self, source: Expr) -> Expr { use Expr::*; match source { Var(l, ty) => self.eval((l, ty)), + Log(l) => Log(Box::new(self.eval(*l))), Op(f, args, ty) => Op(f, self.eval(args), ty), HOp(f, args, rel, ty) => HOp(f, self.clone().eval(args), self.eval(rel), ty), } } } -impl Eval, Neutral> for E -where E: Eval, Head> + Eval>, Vector>> + Clone +impl Eval, Neutral> for E +where E: Eval, Head> + Eval>, Vector>> + Clone { - fn eval(self, source: Neutral) -> Neutral { + fn eval(self, source: Neutral) -> Neutral { let head = self.clone().eval(source.head); let args = self.eval(source.args); Neutral { head, args } @@ -246,12 +258,12 @@ impl Display for Relation { } #[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] -pub enum Head { +pub enum Head { Var(VL), - HOp(String, Vec>, Box), + HOp(String, Vec>, Box), } -impl Display for Head { +impl Display for Head { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { Head::Var(VL(l)) => write!(f, "#{}", l), @@ -262,10 +274,10 @@ impl Display for Head { } } -impl Eval, Head> for E -where E: Eval>, Vec>> + Eval, Box> + Clone +impl Eval, Head> for E +where E: Eval>, Vec>> + Eval, Box> + Clone { - fn eval(self, source: Head) -> Head { + fn eval(self, source: Head) -> Head { use Head::*; match source { Var(v) => Var(v), @@ -275,29 +287,29 @@ where E: Eval>, Vec>> + Eval, Box> + Clone } #[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] -pub struct Neutral { - pub head: Head, - pub args: Vector>, +pub struct Neutral { + pub head: Head, + pub args: Vector>, } -impl Neutral { - pub fn new(head: Head, args: Vector>) -> Self { +impl Neutral { + pub fn new(head: Head, args: Vector>) -> Self { Neutral { head, args } } } -impl Display for Neutral { +impl Display for Neutral { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { write!(f, "{}({})", self.head, self.args.iter().format(", ")) } } /// SQL data types (adapted from sqlparser) -#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] +#[derive( + Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize_enum_str, Deserialize_enum_str, +)] #[serde(rename_all = "UPPERCASE")] pub enum DataType { - /// Uuid type - Uuid, /// Integer #[serde(alias = "INT", alias = "SMALLINT", alias = "BIGINT", alias = "TINYINT")] #[serde(alias = "TIMESTAMP", alias = "DATE", alias = "TIME")] @@ -307,20 +319,12 @@ pub enum DataType { Real, /// Boolean Boolean, - /// Interval - Interval, - /// Regclass used in postgresql serial - Regclass, /// String #[serde(alias = "VARCHAR", alias = "CHAR", alias = "TEXT")] String, /// Custom type such as enums - Custom(String), - /// Arrays - Array(Box), - /// Any type #[serde(other)] - Any, + Custom(String), } #[derive(Clone, Debug, Default, Ord, PartialOrd, Eq, PartialEq, Hash)] @@ -469,15 +473,15 @@ impl<'c> Ctx<'c> { } pub fn sort(&self, ty: &DataType) -> Sort<'c> { + let z3_ctx = self.z3_ctx(); use DataType::*; match ty { - Boolean => &self.bool.sort, - String => &self.string.sort, - Integer => &self.int.sort, - Real => &self.real.sort, - _ => panic!("unsupported type {:?}", ty), + Boolean => self.bool.sort.clone(), + String => self.string.sort.clone(), + Integer => self.int.sort.clone(), + Real => self.real.sort.clone(), + Custom(ty) => Sort::uninterpreted(z3_ctx, z3::Symbol::String(ty.clone())), } - .clone() } pub fn strict_sort(&self, ty: &DataType) -> Sort<'c> { @@ -493,7 +497,7 @@ impl<'c> Ctx<'c> { } pub fn var(&self, ty: &DataType, prefix: &str) -> Dynamic<'c> { - Datatype::fresh_const(self.solver.get_context(), prefix, &self.sort(ty)).into() + Dynamic::fresh_const(self.solver.get_context(), prefix, &self.sort(ty)).into() } pub fn app( @@ -510,9 +514,11 @@ impl<'c> Ctx<'c> { let f = FuncDecl::new(ctx, name, &domain.iter().collect_vec(), &range); f.apply(&args) } - + pub fn timeout() -> Duration { - if let Some(t) = std::env::var("COSETTE_SMT_TIMEOUT").ok().and_then(|t| t.parse::().ok()) { + if let Some(t) = + std::env::var("COSETTE_SMT_TIMEOUT").ok().and_then(|t| t.parse::().ok()) + { Duration::from_millis(t) } else { Duration::from_secs(10) diff --git a/src/pipeline/stable.rs b/src/pipeline/stable.rs index 920364d..a109c29 100644 --- a/src/pipeline/stable.rs +++ b/src/pipeline/stable.rs @@ -6,15 +6,13 @@ use z3::ast::Ast; use z3::SatResult; use super::normal::Z3Env; -use super::shared::{DataType, Eval, Lambda, Terms, Ctx}; +use super::shared::{Ctx, DataType, Eval, Lambda, Terms}; use crate::pipeline::normal; use crate::pipeline::shared::{self, VL}; -pub type Expr<'c> = shared::Expr>; -#[derive(Clone)] -pub struct LogicRel<'c>(pub Vector, pub Env<'c>, pub normal::Logic); -pub type Neutral<'c> = shared::Neutral>; -pub type Logic<'c> = shared::Logic, LogicRel<'c>, Neutral<'c>>; +pub type Expr<'c> = shared::Expr, UExpr<'c>>; +pub type Neutral<'c> = shared::Neutral, UExpr<'c>>; +pub type Logic<'c> = shared::Logic, UExpr<'c>>; #[derive(Clone)] pub struct Relation<'c>(pub Vector, pub Env<'c>, pub normal::UExpr); @@ -53,37 +51,12 @@ impl<'c> Eval> for &Env<'c> { } } -impl<'c> Eval> for &Env<'c> { - fn eval(self, normal::LogicRel(scope, body): normal::LogicRel) -> LogicRel<'c> { - LogicRel(scope, self.clone(), *body) - } -} - -impl<'c> Eval> for &Env<'c> { - fn eval(self, source: normal::Neutral) -> Logic<'c> { - Logic::App(self.eval(source)) - } -} - impl<'c> Eval> for &Env<'c> { fn eval(self, source: normal::UExpr) -> UExpr<'c> { source.into_iter().filter_map(|term| self.eval(term)).collect() } } -fn exprs(logic: &normal::Logic) -> Vec<&normal::Expr> { - use shared::Logic::*; - match logic { - Bool(_) | Pred(_, _) => vec![], - Eq(e1, e2) => vec![e1, e2], - Neg(l) => exprs(l), - And(ls) => ls.iter().flat_map(exprs).collect(), - Or(ls) => ls.iter().flat_map(exprs).collect(), - App(_) => vec![], - Exists(normal::LogicRel(_, l)) => exprs(l), - } -} - fn var_elim<'c>( env: &Env<'c>, vars: &[(u32, &normal::Expr)], @@ -168,7 +141,7 @@ impl<'c> Eval>> for &Env<'c> { let vars = shared::Expr::vars(subst.len(), source.scope.clone()); let exprs = vars .iter() - .chain(exprs(&source.logic)) + .chain(source.logic.exprs()) .filter(|e| e.in_scope(subst.len() + source.scope.len())) .collect_vec(); let z3_asts = exprs.iter().map(|&e| (&z3_env).eval(e)).collect_vec(); @@ -177,20 +150,27 @@ impl<'c> Eval>> for &Env<'c> { solver.assert(&constraint); let handle = solver.get_context().handle(); let checked = crossbeam::atomic::AtomicCell::new(false); + let interrupted = crossbeam::atomic::AtomicCell::new(false); let (ids, res) = crossbeam::thread::scope(|s| { let checked = &checked; + let interrupted = &interrupted; let p = crossbeam::sync::Parker::new(); let u = p.unparker().clone(); s.spawn(move |_| { p.park_timeout(Ctx::timeout()); if !checked.load() { handle.interrupt(); + interrupted.store(true); } }); let (ids, res) = solver.get_implied_equalities(z3_asts.as_slice()); checked.store(true); u.unpark(); - (ids, res) + if interrupted.load() { + (vec![], SatResult::Unknown) + } else { + (ids, res) + } }) .unwrap(); solver.pop(1); diff --git a/src/pipeline/syntax.rs b/src/pipeline/syntax.rs index 8c5ef95..2261b9c 100644 --- a/src/pipeline/syntax.rs +++ b/src/pipeline/syntax.rs @@ -15,7 +15,7 @@ use crate::pipeline::shared::DataType; /// when having the explict definition. /// Here the lambda term uses a vector of data types to bind every components of the input tuple. /// That is, each component is treated as a unique variable that might appear in the function body. -pub type Expr = shared::Expr; +pub type Expr = shared::Expr; #[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] pub struct Application(pub Relation, pub Vector); @@ -26,7 +26,7 @@ pub enum Relation { Lam(Vector, Box), } -pub type Logic = shared::Logic; +pub type Logic = shared::Logic; impl Relation { pub fn lam(scopes: Vector, body: impl Into>) -> Relation { @@ -87,18 +87,6 @@ impl UExpr { pub fn squash(body: impl Into>) -> Self { Squash(body.into()) } - - pub fn as_logic(self) -> Logic { - match self { - Add(us) => Logic::Or(us.into_iter().map(UExpr::as_logic).collect()), - Mul(us) => Logic::And(us.into_iter().map(UExpr::as_logic).collect()), - Squash(u) => u.as_logic(), - Not(u) => !u.as_logic(), - Sum(scopes, body) => Logic::Exists(Relation::Lam(scopes, body)), - Pred(logic) => logic, - App(table, args) => Logic::App(Application(table, args)), - } - } } impl Display for UExpr { diff --git a/src/pipeline/unify.rs b/src/pipeline/unify.rs index 5ebf312..7ba7666 100644 --- a/src/pipeline/unify.rs +++ b/src/pipeline/unify.rs @@ -1,12 +1,11 @@ use std::cell::RefCell; use std::collections::HashMap; -use std::io::Write; +use std::io::{Read, Write}; use std::ops::Deref; use std::process::{Command, Stdio}; use std::rc::Rc; use imbl::Vector; -use isoperm::wrapper::Isoperm; use itertools::Itertools; use z3::ast::{Ast, Bool, Dynamic, Int}; use z3::SatResult; @@ -14,7 +13,7 @@ use z3::SatResult; use super::normal::Term; use super::shared::{self, Ctx}; use crate::pipeline::normal::{Expr, HOpMap, RelHOpMap, Relation, UExpr, Z3Env}; -use crate::pipeline::shared::{DataType, Eval, Head, VL}; +use crate::pipeline::shared::{DataType, Eval}; pub trait Unify { fn unify(self, t1: T, t2: T) -> bool; @@ -114,6 +113,37 @@ fn perm_equiv(v1: &Vector, v2: &Vector) -> bool { } } +fn perms(types: Vec, vars: Vec) -> impl Iterator> +where + T: Ord + PartialEq + Clone, + V: Clone, +{ + use itertools::Either; + let sort_perm = permutation::sort(types.as_slice()); + let sorted_scopes = sort_perm.apply_slice(types.as_slice()); + let sorted_vars = sort_perm.apply_slice(vars.as_slice()); + let groups = sorted_scopes.iter().group_by(|a| *a); + let group_lengths = if types.is_empty() { + Either::Left(std::iter::once(0)) + } else { + Either::Right(groups.into_iter().map(|(_, group)| group.count())) + }; + let mut level = 0; + let inv_sort_perm = sort_perm.inverse(); + group_lengths + .map(|length| { + let perms = (level..level + length).permutations(length); + level += length; + perms + }) + .multi_cartesian_product() + .map(move |perms| { + let perm_vec = perms.into_iter().flatten().collect_vec(); + let permute = &inv_sort_perm * &permutation::Permutation::from_vec(perm_vec); + permute.apply_slice(sorted_vars.as_slice()) + }) +} + impl<'c> Unify<&Term> for &UnifyEnv<'c> { fn unify(self, t1: &Term, t2: &Term) -> bool { if !perm_equiv(&t1.scope, &t2.scope) { @@ -121,87 +151,34 @@ impl<'c> Unify<&Term> for &UnifyEnv<'c> { } log::info!("Unifying\n{}\n{}", t1, t2); let UnifyEnv(ctx, subst1, subst2) = self; - type Var<'e, 'c> = isoperm::wrapper::Var, &'e Expr>; - fn extract<'v, 'c>( - t: &'v Term, - subst: &'v Vector>, - ) -> (Vec<(usize, Vec>)>, HashMap, DataType>) { - let scope = subst.len()..subst.len() + t.scope.len(); - let mut args: HashMap<_, _> = - scope.clone().map(Var::Local).zip(t.scope.clone()).collect(); - let constraints = t - .apps - .iter() - .filter_map(|app| { - let translate = |arg: &'v Expr| match arg { - Expr::Var(VL(l), _) if scope.contains(l) => Var::Local(*l), - Expr::Var(VL(l), ty) => { - let v = &subst[*l]; - args.insert(Var::Global(v), ty.clone()); - Var::Global(v) - }, - arg => { - args.insert(Var::Expr(arg), arg.ty()); - Var::Expr(arg) - }, - }; - match &app.head { - &Head::Var(VL(t)) => Some((t, app.args.iter().map(translate).collect())), - Head::HOp(_, _, _) => None, - } - }) - .collect(); - (constraints, args) - } - let (constraints1, args1) = extract(t1, subst1); - let (constraints2, args2) = extract(t2, subst2); let z3_ctx = ctx.z3_ctx(); let vars1 = t1.scope.iter().map(|ty| ctx.var(ty, "v")).collect(); let subst1 = subst1 + &vars1; - if let Ok(mut perm) = Isoperm::new(constraints1, args1, constraints2, args2) { - perm.result() - .map(|bij| { - bij.into_iter() - .filter_map(|(v1, v2)| match (v1, v2) { - (&Var::Local(l1), &Var::Local(l2)) => Some((l2, subst1[l1].clone())), - _ => None, - }) - .sorted_by_key(|(l, _)| *l) - .map(|(_, v)| v) - .collect_vec() - }) - .take(24) - .any(|vars2| { - assert_eq!(vars2.len(), t2.scope.len()); - log::info!("Permutation: {:?}", vars2); - let subst2 = subst2 + &vars2.into(); - let h_ops = Rc::new(RefCell::new(HashMap::new())); - let rel_h_ops = Rc::new(RefCell::new(HashMap::new())); - let env1 = - &Z3Env(ctx.clone(), subst1.clone(), h_ops.clone(), rel_h_ops.clone()); - let env2 = - &Z3Env(ctx.clone(), subst2.clone(), h_ops.clone(), rel_h_ops.clone()); - let (logic1, apps1): (_, Int<'c>) = (env1.eval(&t1.logic), env1.eval(&t1.apps)); - let (logic2, apps2) = (env2.eval(&t2.logic), env2.eval(&t2.apps)); - let apps_equiv = apps1._eq(&apps2); - let equiv = Bool::and(z3_ctx, &[&logic1.iff(&logic2), &apps_equiv]); - let solver = &ctx.solver; - solver.push(); - solver.assert(&logic1); - solver.assert(&logic2); - let h_ops_equiv = extract_equiv( - ctx.clone(), - h_ops.borrow().deref(), - rel_h_ops.borrow().deref(), - ); - solver.pop(1); - log::info!("{}", equiv); - log::info!("{}", h_ops_equiv); - smt(solver, h_ops_equiv.implies(&equiv)) - }) - } else { - false - } + perms(t1.scope.iter().cloned().collect(), vars1.into_iter().collect()).take(24).any( + |vars2| { + assert_eq!(vars2.len(), t2.scope.len()); + log::info!("Permutation: {:?}", vars2); + let subst2 = subst2 + &vars2.into(); + let h_ops = Rc::new(RefCell::new(HashMap::new())); + let rel_h_ops = Rc::new(RefCell::new(HashMap::new())); + let env1 = &Z3Env(ctx.clone(), subst1.clone(), h_ops.clone(), rel_h_ops.clone()); + let env2 = &Z3Env(ctx.clone(), subst2.clone(), h_ops.clone(), rel_h_ops.clone()); + let (logic1, apps1): (_, Int<'c>) = (env1.eval(&t1.logic), env1.eval(&t1.apps)); + let (logic2, apps2) = (env2.eval(&t2.logic), env2.eval(&t2.apps)); + let equiv = logic1 + .ite(&apps1, &Int::from_i64(z3_ctx, 0)) + ._eq(&logic2.ite(&apps2, &Int::from_i64(z3_ctx, 0))); + let solver = &ctx.solver; + solver.push(); + solver.assert(&Bool::or(z3_ctx, &[&logic1, &logic2])); + let h_ops_equiv = + extract_equiv(ctx.clone(), h_ops.borrow().deref(), rel_h_ops.borrow().deref()); + solver.pop(1); + log::info!("{}", equiv); + log::info!("{}", h_ops_equiv); + smt(solver, h_ops_equiv.implies(&equiv)) + }, + ) } } @@ -210,21 +187,62 @@ pub(crate) fn smt<'c>(solver: &'c z3::Solver, pred: Bool<'c>) -> bool { .dump_smtlib(pred.not()) .replace(" and", " true") .replace(" or", " false") + .replace(")and", ") true") + .replace(")or", ") false") .replace("(* ", "(* 1 ") .replace("(+ ", "(+ 0 "); let smt = smt.strip_prefix("; \n(set-info :status )").unwrap_or(smt.as_str()); - let timeout = "--tlimit=".to_string() + &Ctx::timeout().as_millis().to_string(); - let mut child = Command::new("cvc5") - .args([&timeout, "--strings-exp"]) - .stdin(Stdio::piped()) - .stdout(Stdio::piped()) - .spawn() - .expect("Failed to spawn child process"); - let mut stdin = child.stdin.take().expect("Failed to open stdin"); - stdin.write_all("(set-logic ALL)".as_bytes()).unwrap(); - stdin.write_all(smt.as_bytes()).unwrap(); - drop(stdin); - let output = child.wait_with_output().expect("Failed to read stdout"); - let result = String::from_utf8(output.stdout).unwrap(); - dbg!(result).ends_with("unsat\n") + let res = crossbeam::atomic::AtomicCell::new(false); + crossbeam::thread::scope(|s| { + let res = &res; + let p = crossbeam::sync::Parker::new(); + let u1 = p.unparker().clone(); + let u2 = p.unparker().clone(); + let mut z3_cmd = Command::new("z3") + .args(["-in"]) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .spawn() + .expect("Failed to spawn child process for z3."); + let mut z3_in = z3_cmd.stdin.take().expect("Failed to open stdin."); + let mut z3_out = z3_cmd.stdout.take().expect("Failed to read stdout"); + let mut cvc5_cmd = Command::new("cvc5") + .args(["--strings-exp"]) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .spawn() + .expect("Failed to spawn child process for cvc5."); + let mut cvc5_in = cvc5_cmd.stdin.take().expect("Failed to open stdin."); + let mut cvc5_out = cvc5_cmd.stdout.take().expect("Failed to capture stdout"); + s.spawn(move |_| { + z3_in.write_all(smt.as_bytes()).unwrap(); + drop(z3_in); + let mut result = String::new(); + z3_out.read_to_string(&mut result).expect("Failed to read stdout."); + let provable = dbg!(&result).starts_with("unsat\n"); + res.fetch_or(provable); + if !result.starts_with("unknown\n") { + u1.unpark(); + } + }); + s.spawn(move |_| { + cvc5_in.write_all("(set-logic ALL)".as_bytes()).unwrap(); + cvc5_in.write_all(smt.as_bytes()).unwrap(); + drop(cvc5_in); + let mut result = String::new(); + cvc5_out.read_to_string(&mut result).expect("Failed to read stdout."); + let provable = dbg!(&result).ends_with("unsat\n"); + res.fetch_or(provable); + if !result.ends_with("unknown\n") { + u2.unpark(); + } + }); + p.park_timeout(Ctx::timeout()); + z3_cmd.kill().unwrap(); + z3_cmd.wait().unwrap(); + cvc5_cmd.kill().unwrap(); + cvc5_cmd.wait().unwrap(); + res.load() + }) + .unwrap() } diff --git a/tests/RelOptRulesTest/testAddRedundantSemiJoinRule.json b/tests/RelOptRulesTest/testAddRedundantSemiJoinRule.json deleted file mode 100644 index 68449ce..0000000 --- a/tests/RelOptRulesTest/testAddRedundantSemiJoinRule.json +++ /dev/null @@ -1,136 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[semi])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateCaseToFilter.json b/tests/RelOptRulesTest/testAggregateCaseToFilter.json deleted file mode 100644 index 632e82d..0000000 --- a/tests/RelOptRulesTest/testAggregateCaseToFilter.json +++ /dev/null @@ -1,1335 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'CLERK'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "40", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'x'", - "operand": [], - "type": "CHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "CHAR" - } - ], - "type": "CHAR" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "45", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "50", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "DECIMAL" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "70", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 5, - "type": "CHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 8, - "type": "DECIMAL" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "DECIMAL" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 10, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'CLERK'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "40", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'x'", - "operand": [], - "type": "CHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "CHAR" - } - ], - "type": "CHAR" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "45", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "50", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "DECIMAL" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "70", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 4, - "type": "BIGINT" - } - ], - "type": "INTEGER" - }, - { - "column": 5, - "type": "BIGINT" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "DECIMAL" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "DECIMAL" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'CLERK'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "40", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "45", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "50", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "<>", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "70", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 10, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 12, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 1, - "type": "DECIMAL" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "DECIMAL" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 14, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "DECIMAL" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'CLERK'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "40", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "45", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "50", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "<>", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "70", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)], COUNT_DISTINCT_CLERK=[COUNT(DISTINCT $1)], SUM_SAL_D10=[SUM($2)], SUM_SAL_D20=[SUM($3)], COUNT_D30=[SUM($4)], COUNT_D40=[COUNT($5)], COUNT_D45=[SUM($6)], COUNT_D50=[SUM($7)], SUM_NULL_D60=[SUM($8)], SUM_NULL_D70=[SUM($9)], COUNT_D20=[COUNT($10)])\r\n LogicalProject(SAL=[$1], $f1=[CASE(=($0, 'CLERK'), $2, null:INTEGER)], $f2=[CASE(=($2, 10), $1, null:INTEGER)], $f3=[CASE(=($2, 20), $1, 0)], $f4=[CASE(=($2, 30), 1, 0)], $f5=[CASE(=($2, 40), 'x', null:CHAR(1))], $f6=[CASE(=($2, 45), 1, null:INTEGER)], $f7=[CASE(=($2, 50), 1, null:INTEGER)], $f8=[null:DECIMAL(19, 9)], $f9=[CASE(=($2, 70), null:INTEGER, 1)], $f10=[CASE(=($2, 20), 1, null:INTEGER)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(SUM_SAL=[$0], COUNT_DISTINCT_CLERK=[$1], SUM_SAL_D10=[$2], SUM_SAL_D20=[$3], COUNT_D30=[CAST($4):INTEGER], COUNT_D40=[$5], COUNT_D45=[$6], COUNT_D50=[$7], SUM_NULL_D60=[$8], SUM_NULL_D70=[$9], COUNT_D20=[$10])\r\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)], COUNT_DISTINCT_CLERK=[COUNT(DISTINCT $2) FILTER $3], SUM_SAL_D10=[SUM($4) FILTER $5], SUM_SAL_D20=[SUM($6) FILTER $7], COUNT_D30=[COUNT() FILTER $8], COUNT_D40=[COUNT() FILTER $9], COUNT_D45=[SUM($10) FILTER $11], COUNT_D50=[SUM($12) FILTER $13], SUM_NULL_D60=[SUM($1)], SUM_NULL_D70=[SUM($14) FILTER $15], COUNT_D20=[COUNT() FILTER $16])\r\n LogicalProject(SAL=[$1], $f8=[null:DECIMAL(19, 9)], DEPTNO=[$2], $f12=[=($0, 'CLERK')], SAL0=[$1], $f14=[=($2, 10)], SAL1=[$1], $f16=[=($2, 20)], $f17=[=($2, 30)], $f18=[=($2, 40)], $f19=[1], $f20=[=($2, 45)], $f21=[1], $f22=[=($2, 50)], $f23=[1], $f24=[<>($2, 70)], $f25=[=($2, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateConstantKeyRule.json b/tests/RelOptRulesTest/testAggregateConstantKeyRule.json deleted file mode 100644 index c6b709f..0000000 --- a/tests/RelOptRulesTest/testAggregateConstantKeyRule.json +++ /dev/null @@ -1,307 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(C=[$2])\r\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\r\n LogicalProject(DEPTNO=[$1], SAL=[$0])\r\n LogicalFilter(condition=[=($1, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(C=[$1])\r\n LogicalAggregate(group=[{0}], C=[COUNT()])\r\n LogicalProject(SAL=[$0])\r\n LogicalFilter(condition=[=($1, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateConstantKeyRule3.json b/tests/RelOptRulesTest/testAggregateConstantKeyRule3.json deleted file mode 100644 index a8892f0..0000000 --- a/tests/RelOptRulesTest/testAggregateConstantKeyRule3.json +++ /dev/null @@ -1,424 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "MGR" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - true - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'Clerk'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'Clerk'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "_ISO-8859-1'Clerk'", - "operand": [], - "type": "VARCHAR" - }, - { - "column": 1, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'Clerk'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'Clerk'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(JOB=[$1])\r\n LogicalFilter(condition=[>($2, 3)])\r\n LogicalAggregate(group=[{0, 1}], agg#0=[COUNT()])\r\n LogicalProject(MGR=[$1], JOB=[$0])\r\n LogicalFilter(condition=[AND(IS NULL($1), =($0, 'Clerk'))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(JOB=[$0])\r\n LogicalFilter(condition=[>($1, 3)])\r\n LogicalProject(JOB=['Clerk':VARCHAR(10)], $f2=[$1])\r\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\r\n LogicalProject(MGR=[$1])\r\n LogicalFilter(condition=[AND(IS NULL($1), =($0, 'Clerk'))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateDynamicFunction.json b/tests/RelOptRulesTest/testAggregateDynamicFunction.json deleted file mode 100644 index bcecfec..0000000 --- a/tests/RelOptRulesTest/testAggregateDynamicFunction.json +++ /dev/null @@ -1,396 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "MGR", - "HIREDATE" - ], - "types": [ - "INTEGER", - "TIMESTAMP" - ], - "nullable": [ - true, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "TIMESTAMP" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "TIMESTAMP" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "TIMESTAMP" - }, - { - "operator": "CURRENT_TIMESTAMP", - "operand": [], - "type": "TIMESTAMP" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "TIMESTAMP" - }, - { - "column": 3, - "type": "TIMESTAMP" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "TIMESTAMP" - }, - { - "operator": "CURRENT_TIMESTAMP", - "operand": [], - "type": "TIMESTAMP" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "TIMESTAMP" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CURRENT_TIMESTAMP", - "operand": [], - "type": "TIMESTAMP" - }, - { - "column": 1, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "TIMESTAMP" - }, - { - "operator": "CURRENT_TIMESTAMP", - "operand": [], - "type": "TIMESTAMP" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "TIMESTAMP" - }, - { - "operator": "CURRENT_TIMESTAMP", - "operand": [], - "type": "TIMESTAMP" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(HIREDATE=[$1])\r\n LogicalFilter(condition=[>($2, 3)])\r\n LogicalAggregate(group=[{0, 1}], agg#0=[COUNT()])\r\n LogicalFilter(condition=[AND(IS NULL($0), =($1, CURRENT_TIMESTAMP))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(HIREDATE=[$0])\r\n LogicalFilter(condition=[>($1, 3)])\r\n LogicalProject(HIREDATE=[CURRENT_TIMESTAMP], $f2=[$1])\r\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\r\n LogicalProject(MGR=[$0])\r\n LogicalFilter(condition=[AND(IS NULL($0), =($1, CURRENT_TIMESTAMP))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateExtractProjectRule.json b/tests/RelOptRulesTest/testAggregateExtractProjectRule.json deleted file mode 100644 index db5c125..0000000 --- a/tests/RelOptRulesTest/testAggregateExtractProjectRule.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateExtractProjectRuleWithGroupingSets.json b/tests/RelOptRulesTest/testAggregateExtractProjectRuleWithGroupingSets.json deleted file mode 100644 index 1c24135..0000000 --- a/tests/RelOptRulesTest/testAggregateExtractProjectRuleWithGroupingSets.json +++ /dev/null @@ -1,198 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}, {2}]], EXPR$2=[SUM($1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}, {2}]], EXPR$2=[SUM($1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateExtractProjectRuleWithGroupingSets2.json b/tests/RelOptRulesTest/testAggregateExtractProjectRuleWithGroupingSets2.json deleted file mode 100644 index fe041d3..0000000 --- a/tests/RelOptRulesTest/testAggregateExtractProjectRuleWithGroupingSets2.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {1}]], EXPR$2=[SUM($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {1}]], EXPR$2=[SUM($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateGroupingSetsProjectMerge.json b/tests/RelOptRulesTest/testAggregateGroupingSetsProjectMerge.json deleted file mode 100644 index 0b4e2f4..0000000 --- a/tests/RelOptRulesTest/testAggregateGroupingSetsProjectMerge.json +++ /dev/null @@ -1,288 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\r\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$1=[SUM($2)])\r\n LogicalProject(X=[$2], Y=[$0], Z=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\r\n LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$1=[$2])\r\n LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {2}, {}]], EXPR$1=[SUM($1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateJoinRemove1.json b/tests/RelOptRulesTest/testAggregateJoinRemove1.json deleted file mode 100644 index 7cc0bf8..0000000 --- a/tests/RelOptRulesTest/testAggregateJoinRemove1.json +++ /dev/null @@ -1,208 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}])\r\n LogicalProject(DEPTNO=[$0])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateJoinRemove10.json b/tests/RelOptRulesTest/testAggregateJoinRemove10.json deleted file mode 100644 index e704de3..0000000 --- a/tests/RelOptRulesTest/testAggregateJoinRemove10.json +++ /dev/null @@ -1,393 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1, $2)])\r\n LogicalProject(DEPTNO=[$0], NAME=[$2], NAME0=[$4])\r\n LogicalJoin(condition=[=($0, $3)], joinType=[left])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $2, $4)])\r\n LogicalJoin(condition=[=($0, $3)], joinType=[left])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateJoinRemove11.json b/tests/RelOptRulesTest/testAggregateJoinRemove11.json deleted file mode 100644 index 26d2177..0000000 --- a/tests/RelOptRulesTest/testAggregateJoinRemove11.json +++ /dev/null @@ -1,245 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\r\n LogicalProject(DEPTNO=[$0], SLACKER=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateJoinRemove2.json b/tests/RelOptRulesTest/testAggregateJoinRemove2.json deleted file mode 100644 index 99dc048..0000000 --- a/tests/RelOptRulesTest/testAggregateJoinRemove2.json +++ /dev/null @@ -1,245 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{1}], EXPR$1=[COUNT(DISTINCT $0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateJoinRemove3.json b/tests/RelOptRulesTest/testAggregateJoinRemove3.json deleted file mode 100644 index 1f29a19..0000000 --- a/tests/RelOptRulesTest/testAggregateJoinRemove3.json +++ /dev/null @@ -1,289 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\r\n LogicalProject(DEPTNO=[$0], NAME=[$2])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $2)])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateJoinRemove4.json b/tests/RelOptRulesTest/testAggregateJoinRemove4.json deleted file mode 100644 index 03254ed..0000000 --- a/tests/RelOptRulesTest/testAggregateJoinRemove4.json +++ /dev/null @@ -1,160 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "scan": 1 - } - ], - "help": [ - "LogicalAggregate(group=[{0}])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateJoinRemove5.json b/tests/RelOptRulesTest/testAggregateJoinRemove5.json deleted file mode 100644 index 3ed5209..0000000 --- a/tests/RelOptRulesTest/testAggregateJoinRemove5.json +++ /dev/null @@ -1,245 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\r\n LogicalProject(DEPTNO=[$1], NAME=[$2])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateJoinRemove6.json b/tests/RelOptRulesTest/testAggregateJoinRemove6.json deleted file mode 100644 index 10edcad..0000000 --- a/tests/RelOptRulesTest/testAggregateJoinRemove6.json +++ /dev/null @@ -1,289 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$0])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{2}], EXPR$1=[COUNT(DISTINCT $0)])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateJoinRemove7.json b/tests/RelOptRulesTest/testAggregateJoinRemove7.json deleted file mode 100644 index da3c335..0000000 --- a/tests/RelOptRulesTest/testAggregateJoinRemove7.json +++ /dev/null @@ -1,296 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}])\r\n LogicalProject(DEPTNO=[$0])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{0}])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateJoinRemove8.json b/tests/RelOptRulesTest/testAggregateJoinRemove8.json deleted file mode 100644 index ac518fb..0000000 --- a/tests/RelOptRulesTest/testAggregateJoinRemove8.json +++ /dev/null @@ -1,353 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\r\n LogicalProject(DEPTNO=[$0], NAME0=[$3])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $2)])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateJoinRemove9.json b/tests/RelOptRulesTest/testAggregateJoinRemove9.json deleted file mode 100644 index b94ce3a..0000000 --- a/tests/RelOptRulesTest/testAggregateJoinRemove9.json +++ /dev/null @@ -1,363 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(DEPTNO=[$0], NAME=[$3])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{0, 2}])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateMerge1.json b/tests/RelOptRulesTest/testAggregateMerge1.json deleted file mode 100644 index 1b86a07..0000000 --- a/tests/RelOptRulesTest/testAggregateMerge1.json +++ /dev/null @@ -1,532 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "MGR", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - true, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 7, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 6, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{1}], EXPR$1=[MIN($4)], Z=[MAX($3)], EXPR$3=[SUM($6)], N=[SUM($5)], SAL=[SUM($2)])\r\n LogicalAggregate(group=[{0, 3}], X=[SUM($2)], Z=[MAX($2)], Y=[MIN($2)], M=[COUNT()], R=[COUNT($1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{2}], EXPR$1=[MIN($1)], Z=[MAX($1)], EXPR$3=[COUNT($0)], N=[COUNT()], SAL=[SUM($1)])\r\n LogicalProject(MGR=[$1], SAL=[$2], DEPTNO=[$3])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateMerge2.json b/tests/RelOptRulesTest/testAggregateMerge2.json deleted file mode 100644 index 96e538f..0000000 --- a/tests/RelOptRulesTest/testAggregateMerge2.json +++ /dev/null @@ -1,534 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "MGR", - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "VARCHAR", - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - true, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 6, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 8, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$2=[$2], EXPR$3=[$3])\r\n LogicalAggregate(group=[{0, 2}], groups=[[{0}, {2}]], EXPR$2=[SUM($3)], EXPR$3=[SUM($4)])\r\n LogicalAggregate(group=[{0, 1, 4}], X=[SUM($3)], Y=[COUNT($2)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$2=[$2], EXPR$3=[$3])\r\n LogicalAggregate(group=[{0, 3}], groups=[[{0}, {3}]], EXPR$2=[SUM($2)], EXPR$3=[COUNT($1)])\r\n LogicalProject(EMPNO=[$0], MGR=[$2], SAL=[$3], DEPTNO=[$4])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateMerge8.json b/tests/RelOptRulesTest/testAggregateMerge8.json deleted file mode 100644 index 28eda9a..0000000 --- a/tests/RelOptRulesTest/testAggregateMerge8.json +++ /dev/null @@ -1,242 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], X=[SUM($0)], Z=[MIN($1)])\r\n LogicalAggregate(group=[{}], X=[SUM($0)], Y=[MIN($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], X=[SUM($0)], Z=[MIN($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateMergeSum0.json b/tests/RelOptRulesTest/testAggregateMergeSum0.json deleted file mode 100644 index 7f3815e..0000000 --- a/tests/RelOptRulesTest/testAggregateMergeSum0.json +++ /dev/null @@ -1,339 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 2, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], agg#0=[$SUM0($2)])\r\n LogicalAggregate(group=[{0, 1}], COUNT_COMM=[COUNT()])\r\n LogicalProject(MGR=[$3], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], agg#0=[COUNT()])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateProjectMerge.json b/tests/RelOptRulesTest/testAggregateProjectMerge.json deleted file mode 100644 index a733c3d..0000000 --- a/tests/RelOptRulesTest/testAggregateProjectMerge.json +++ /dev/null @@ -1,288 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\r\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM($2)])\r\n LogicalProject(X=[$2], Y=[$0], Z=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\r\n LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$1=[$2])\r\n LogicalAggregate(group=[{0, 2}], EXPR$1=[SUM($1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateProjectPullUpConstants.json b/tests/RelOptRulesTest/testAggregateProjectPullUpConstants.json deleted file mode 100644 index 9158211..0000000 --- a/tests/RelOptRulesTest/testAggregateProjectPullUpConstants.json +++ /dev/null @@ -1,379 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "JOB", - "SAL" - ], - "types": [ - "INTEGER", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1, 2}], S=[SUM($2)])\r\n LogicalProject(JOB=[$1], EMPNO=[$0], SAL=[$2])\r\n LogicalFilter(condition=[=($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(JOB=[$0], EMPNO=[10], SAL=[$1], S=[$2])\r\n LogicalAggregate(group=[{0, 1}], S=[SUM($1)])\r\n LogicalProject(JOB=[$1], SAL=[$2])\r\n LogicalFilter(condition=[=($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateProjectPullUpConstants2.json b/tests/RelOptRulesTest/testAggregateProjectPullUpConstants2.json deleted file mode 100644 index 236396d..0000000 --- a/tests/RelOptRulesTest/testAggregateProjectPullUpConstants2.json +++ /dev/null @@ -1,238 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "SAL" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'John'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'John'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "operator": "_ISO-8859-1'John'", - "operand": [], - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'John'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'John'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}])\r\n LogicalFilter(condition=[=($0, 'John')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(ENAME=['John':VARCHAR(20)], SAL=[$0])\r\n LogicalAggregate(group=[{1}])\r\n LogicalFilter(condition=[=($0, 'John')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateRemove1.json b/tests/RelOptRulesTest/testAggregateRemove1.json deleted file mode 100644 index a6566f1..0000000 --- a/tests/RelOptRulesTest/testAggregateRemove1.json +++ /dev/null @@ -1,298 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "BIT_AND", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "BIT_OR", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "BIGINT" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], EXPR$1=[$2], EXPR$2=[$3], EXPR$3=[$4], EXPR$4=[$5], EXPR$5=[$6], EXPR$6=[$7])\r\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM($2)], EXPR$2=[MIN($2)], EXPR$3=[MAX($2)], EXPR$4=[BIT_AND($2)], EXPR$5=[BIT_OR($2)], EXPR$6=[COUNT(DISTINCT $2)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$2], SAL=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], EXPR$1=[$1], EXPR$2=[$1], EXPR$3=[$1], EXPR$4=[$1], EXPR$5=[$1], EXPR$6=[1:BIGINT])\r\n LogicalProject(EMPNO=[$0], SAL=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateRemove2.json b/tests/RelOptRulesTest/testAggregateRemove2.json deleted file mode 100644 index cbb3f11..0000000 --- a/tests/RelOptRulesTest/testAggregateRemove2.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ], - "help": [ - "LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateRemove3.json b/tests/RelOptRulesTest/testAggregateRemove3.json deleted file mode 100644 index d3d592b..0000000 --- a/tests/RelOptRulesTest/testAggregateRemove3.json +++ /dev/null @@ -1,219 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "MGR", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - true, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], EXPR$1=[$2])\r\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT($2)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$2], MGR=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], EXPR$1=[CASE(IS NOT NULL($1), 1:BIGINT, 0:BIGINT)])\r\n LogicalProject(EMPNO=[$0], MGR=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateRemove7.json b/tests/RelOptRulesTest/testAggregateRemove7.json deleted file mode 100644 index 6e7b5b5..0000000 --- a/tests/RelOptRulesTest/testAggregateRemove7.json +++ /dev/null @@ -1,541 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "MGR", - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - true, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalProject(MGR=[$0], SUM_SAL=[$2])\r\n LogicalFilter(condition=[=($1, 100)])\r\n LogicalAggregate(group=[{0, 1}], SUM_SAL=[SUM($2)])\r\n LogicalProject(MGR=[$0], DEPTNO=[$2], SAL=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(MGR=[$0], SUM_SAL=[$2])\r\n LogicalFilter(condition=[=($1, 100)])\r\n LogicalAggregate(group=[{0, 1}], SUM_SAL=[SUM($2)])\r\n LogicalProject(MGR=[$0], DEPTNO=[$2], SAL=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateUnionTransposeWithOneInputUnique.json b/tests/RelOptRulesTest/testAggregateUnionTransposeWithOneInputUnique.json deleted file mode 100644 index 432d2be..0000000 --- a/tests/RelOptRulesTest/testAggregateUnionTransposeWithOneInputUnique.json +++ /dev/null @@ -1,1090 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalUnion(all=[true])\r\n LogicalProject(DEPTNO=[$0], T=[1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(DEPTNO=[$0], T=[2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalProject(DEPTNO=[$0], T=[1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(DEPTNO=[$0], T=[2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json b/tests/RelOptRulesTest/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json deleted file mode 100644 index 10a81cd..0000000 --- a/tests/RelOptRulesTest/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json +++ /dev/null @@ -1,956 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 2, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$1], T2=[$0])\r\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT($0)])\r\n LogicalUnion(all=[true])\r\n LogicalProject(T1=[CASE(=($0, 0), 1, null:INTEGER)], T2=[1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(T1=[CASE(=($0, 0), 1, null:INTEGER)], T2=[2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[$1], T2=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[$SUM0($1)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT($0)])\r\n LogicalProject(T1=[CASE(=($0, 0), 1, null:INTEGER)], T2=[1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT($0)])\r\n LogicalProject(T1=[CASE(=($0, 0), 1, null:INTEGER)], T2=[2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAll.json b/tests/RelOptRulesTest/testAll.json deleted file mode 100644 index 485c5fa..0000000 --- a/tests/RelOptRulesTest/testAll.json +++ /dev/null @@ -1,454 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "NOT", - "operand": [ - { - "operator": "<= SOME", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "query": { - "scan": 1 - }, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "NOT", - "operand": [ - { - "operator": "CAST", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "<=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "column": 11, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT TRUE", - "operand": [ - { - "operator": "<=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "<=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT TRUE", - "operand": [ - { - "operator": "<=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<=", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "column": 11, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 1, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[NOT(<= SOME($0, {\nLogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n}))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[NOT(CAST(OR(AND(IS TRUE(<=($0, $9)), <>($10, 0)), AND(>($10, $11), null, <>($10, 0), IS NOT TRUE(<=($0, $9))), AND(<=($0, $9), <>($10, 0), IS NOT TRUE(<=($0, $9)), <=($10, $11)))):BOOLEAN NOT NULL)])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(m=[$0], c=[$1], d=[$1])\r\n LogicalAggregate(group=[{}], m=[MAX($0)], c=[COUNT()])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAlreadyFalseEliminatesFilter.json b/tests/RelOptRulesTest/testAlreadyFalseEliminatesFilter.json deleted file mode 100644 index 0f9faf0..0000000 --- a/tests/RelOptRulesTest/testAlreadyFalseEliminatesFilter.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\r\n LogicalFilter(condition=[false])\r\n LogicalValues(tuples=[[{ 1, 2 }]])\r\n", - "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAntiJoinProjectTranspose.json b/tests/RelOptRulesTest/testAntiJoinProjectTranspose.json deleted file mode 100644 index 98fc91d..0000000 --- a/tests/RelOptRulesTest/testAntiJoinProjectTranspose.json +++ /dev/null @@ -1,348 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "DNAME" - ], - "types": [ - "TINYINT", - "VARCHAR" - ], - "nullable": [ - false, - true - ], - "key": [ - [ - 0 - ], - [ - 1 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "DNAME" - ], - "types": [ - "TINYINT", - "VARCHAR" - ], - "nullable": [ - false, - true - ], - "key": [ - [ - 0 - ], - [ - 1 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "ANTI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "TINYINT" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "*", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "column": 0, - "type": "TINYINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "TINYINT" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "*", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "TINYINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "TINYINT" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "ANTI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "TINYINT" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "*", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "column": 0, - "type": "TINYINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "TINYINT" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "*", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "TINYINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "TINYINT" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(DNAME=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[anti])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject($f0=[*(2, $0)])\r\n LogicalProject(DEPTNO=[$0])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n", - "LogicalProject(DNAME=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[anti])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject($f0=[*(2, $0)])\r\n LogicalProject(DEPTNO=[$0])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAnyInProjectNonNullable.json b/tests/RelOptRulesTest/testAnyInProjectNonNullable.json deleted file mode 100644 index fd2642e..0000000 --- a/tests/RelOptRulesTest/testAnyInProjectNonNullable.json +++ /dev/null @@ -1,345 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "> SOME", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "query": { - "scan": 1 - }, - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "IS TRUE", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT TRUE", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT TRUE", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 1, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(NAME=[$1], EXPR$1=[> SOME($0, {\nLogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n})])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(NAME=[$1], EXPR$1=[CAST(OR(AND(IS TRUE(>($0, $2)), <>($3, 0)), AND(>($3, $4), null, <>($3, 0), IS NOT TRUE(>($0, $2))), AND(>($0, $2), <>($3, 0), IS NOT TRUE(>($0, $2)), <=($3, $4)))):BOOLEAN NOT NULL])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(m=[$0], c=[$1], d=[$1])\r\n LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testAnyInProjectNullable.json b/tests/RelOptRulesTest/testAnyInProjectNullable.json deleted file mode 100644 index 1ea2f43..0000000 --- a/tests/RelOptRulesTest/testAnyInProjectNullable.json +++ /dev/null @@ -1,350 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "MGR" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - true - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "IN", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "query": { - "scan": 1 - }, - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 5, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "column": 2, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 5, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - }, - { - "column": 3, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0], EXPR$1=[IN($1, {\nLogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n})])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(DEPTNO=[$0], EXPR$1=[OR(AND(IS NOT NULL($5), <>($2, 0)), AND(<($3, $2), null, <>($2, 0), IS NULL($5)))])\r\n LogicalJoin(condition=[=($1, $4)], joinType=[left])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(MGR=[$0], i=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testBitAndReuseDistinctAttrWithMixedOptionality.json b/tests/RelOptRulesTest/testBitAndReuseDistinctAttrWithMixedOptionality.json deleted file mode 100644 index 0e06eca..0000000 --- a/tests/RelOptRulesTest/testBitAndReuseDistinctAttrWithMixedOptionality.json +++ /dev/null @@ -1,251 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "BIT_AND", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "BIT_AND", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[BIT_AND($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT()], EXPR$2=[BIT_AND($0)])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testBitOrReuseDistinctAttrWithMixedOptionality.json b/tests/RelOptRulesTest/testBitOrReuseDistinctAttrWithMixedOptionality.json deleted file mode 100644 index 678616c..0000000 --- a/tests/RelOptRulesTest/testBitOrReuseDistinctAttrWithMixedOptionality.json +++ /dev/null @@ -1,251 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "BIT_OR", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "BIT_OR", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[BIT_OR($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT()], EXPR$2=[BIT_OR($0)])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testCasePushIsAlwaysWorking.json b/tests/RelOptRulesTest/testCasePushIsAlwaysWorking.json deleted file mode 100644 index 9b2fcdf..0000000 --- a/tests/RelOptRulesTest/testCasePushIsAlwaysWorking.json +++ /dev/null @@ -1,162 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "SAL" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[=(CASE(>($1, 1000), $0, $1), 1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[OR(AND(>($1, 1000), =($0, 1)), =($1, 1))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testCastInAggregateExpandDistinctAggregatesRule.json b/tests/RelOptRulesTest/testCastInAggregateExpandDistinctAggregatesRule.json deleted file mode 100644 index bc6e725..0000000 --- a/tests/RelOptRulesTest/testCastInAggregateExpandDistinctAggregatesRule.json +++ /dev/null @@ -1,1095 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "BIGINT" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 1, - "type": "BIGINT" - } - ], - "type": "BIGINT" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "GROUPING", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "BIGINT" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "BIGINT" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "BIGINT" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "GROUPING", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "BIGINT" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "column": 5, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM(DISTINCT $1)], EXPR$2=[SUM(DISTINCT $2)])\r\n LogicalAggregate(group=[{0}], CN=[COUNT()], SM=[SUM($1)])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(NAME=[$0], EXPR$1=[CAST($1):BIGINT NOT NULL], EXPR$2=[CAST($2):INTEGER NOT NULL])\r\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) FILTER $3], EXPR$2=[SUM($2) FILTER $4])\r\n LogicalProject(NAME=[$0], CN=[$1], SM=[$2], $g_1=[=($3, 1)], $g_2=[=($3, 2)])\r\n LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1}, {0, 2}]], $g=[GROUPING($0, $1, $2)])\r\n LogicalAggregate(group=[{0}], CN=[COUNT()], SM=[SUM($1)])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testCastInAggregateReduceFunctions.json b/tests/RelOptRulesTest/testCastInAggregateReduceFunctions.json deleted file mode 100644 index 9ea144d..0000000 --- a/tests/RelOptRulesTest/testCastInAggregateReduceFunctions.json +++ /dev/null @@ -1,664 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "STDDEV_POP", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "AVG", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "STDDEV_SAMP", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "VAR_POP", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "VAR_SAMP", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "POWER", - "operand": [ - { - "operator": "/", - "operand": [ - { - "operator": "-", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "/", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "BIGINT" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - }, - { - "operator": "0.5", - "operand": [], - "type": "DECIMAL" - } - ], - "type": "DOUBLE" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "/", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "POWER", - "operand": [ - { - "operator": "/", - "operand": [ - { - "operator": "-", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "/", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "BIGINT" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "BIGINT" - }, - { - "operator": "-", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "BIGINT" - }, - { - "operator": "0.5", - "operand": [], - "type": "DECIMAL" - } - ], - "type": "DOUBLE" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "/", - "operand": [ - { - "operator": "-", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "/", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "BIGINT" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "/", - "operand": [ - { - "operator": "-", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "/", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "BIGINT" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "BIGINT" - }, - { - "operator": "-", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "$SUM0", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[STDDEV_SAMP($1)], EXPR$4=[VAR_POP($1)], EXPR$5=[VAR_SAMP($1)])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(NAME=[$0], EXPR$1=[CAST(POWER(/(-($1, /(*($2, $2), $3)), $3), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[CAST(POWER(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1))), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$4=[CAST(/(-($1, /(*($2, $2), $3)), $3)):INTEGER NOT NULL], EXPR$5=[CAST(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1)))):INTEGER NOT NULL])\r\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($2)], agg#1=[$SUM0($1)], agg#2=[COUNT()])\r\n LogicalProject(NAME=[$0], DEPTNO=[$1], $f2=[*($1, $1)])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testCustomColumnResolvingInCorrelatedSubQuery.json b/tests/RelOptRulesTest/testCustomColumnResolvingInCorrelatedSubQuery.json deleted file mode 100644 index b7e5a2b..0000000 --- a/tests/RelOptRulesTest/testCustomColumnResolvingInCorrelatedSubQuery.json +++ /dev/null @@ -1,407 +0,0 @@ -{ - "schemas": [ - { - "name": "T", - "fields": [ - "\"K0\"", - "\"C1\"", - "\"F1\".\"A0\"", - "\"F2\".\"A0\"", - "\"F0\".\"C0\"", - "\"F1\".\"C0\"", - "\"F0\".\"C1\"", - "\"F1\".\"C2\"", - "\"F2\".\"C3\"" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER", - "BOOLEAN", - "INTEGER", - "INTEGER", - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false, - false, - true, - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BOOLEAN" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "$SCALAR_QUERY", - "operand": [], - "query": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "column": 14, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 9, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 14, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 9, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BOOLEAN" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "correlate": [ - { - "scan": 0 - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "column": 10, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 9, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 9, - "type": "VARCHAR" - }, - { - "column": 14, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 10, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 9, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 9, - "type": "VARCHAR" - }, - { - "column": 14, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ], - "help": [ - "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\r\n LogicalFilter(condition=[=($4, $SCALAR_QUERY({\nLogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\r\n LogicalProject(\"F1\".\"C0\"=[$5])\r\n LogicalFilter(condition=[=($cor0.\"K0\", $0)])\r\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\r\n}))], variablesSet=[[$cor0]])\r\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\r\n", - "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\r\n LogicalFilter(condition=[=($4, $9)])\r\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{0}])\r\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\r\n LogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\r\n LogicalProject(\"F1\".\"C0\"=[$1])\r\n LogicalFilter(condition=[=($cor0.\"K0\", $0)])\r\n LogicalProject(\"K0\"=[$0], \"F1\".\"C0\"=[$5])\r\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testCustomColumnResolvingInCorrelatedSubQuery2.json b/tests/RelOptRulesTest/testCustomColumnResolvingInCorrelatedSubQuery2.json deleted file mode 100644 index f378b2c..0000000 --- a/tests/RelOptRulesTest/testCustomColumnResolvingInCorrelatedSubQuery2.json +++ /dev/null @@ -1,340 +0,0 @@ -{ - "schemas": [ - { - "name": "T", - "fields": [ - "\"K0\"", - "\"C1\"", - "\"F1\".\"A0\"", - "\"F2\".\"A0\"", - "\"F0\".\"C0\"", - "\"F1\".\"C0\"", - "\"F0\".\"C1\"", - "\"F1\".\"C2\"", - "\"F2\".\"C3\"" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER", - "BOOLEAN", - "INTEGER", - "INTEGER", - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false, - false, - true, - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BOOLEAN" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "column": 14, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BOOLEAN" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "correlate": [ - { - "scan": 0 - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 14, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 10, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 11, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 15, - "type": "INTEGER" - }, - { - "column": 17, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ], - "help": [ - "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\r\n LogicalFilter(condition=[IN($4, {\nLogicalProject(C0=[$5])\r\n LogicalFilter(condition=[=($cor0.\"F1\".\"C2\", $7)])\r\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\r\n})], variablesSet=[[$cor0]])\r\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\r\n", - "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\r\n LogicalFilter(condition=[=($4, $9)])\r\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{7}])\r\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(C0=[$0])\r\n LogicalFilter(condition=[=($cor0.\"F1\".\"C2\", $1)])\r\n LogicalProject(\"F1\".\"C0\"=[$5], \"F1\".\"C2\"=[$7])\r\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testCustomColumnResolvingInNonCorrelatedSubQuery.json b/tests/RelOptRulesTest/testCustomColumnResolvingInNonCorrelatedSubQuery.json deleted file mode 100644 index 95f99aa..0000000 --- a/tests/RelOptRulesTest/testCustomColumnResolvingInNonCorrelatedSubQuery.json +++ /dev/null @@ -1,255 +0,0 @@ -{ - "schemas": [ - { - "name": "T", - "fields": [ - "\"K0\"", - "\"C1\"", - "\"F1\".\"A0\"", - "\"F2\".\"A0\"", - "\"F0\".\"C0\"", - "\"F1\".\"C0\"", - "\"F0\".\"C1\"", - "\"F1\".\"C2\"", - "\"F2\".\"C3\"" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER", - "BOOLEAN", - "INTEGER", - "INTEGER", - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false, - false, - true, - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BOOLEAN" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "column": 14, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BOOLEAN" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\r\n LogicalFilter(condition=[IN($4, {\nLogicalProject(C0=[$5])\r\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\r\n})])\r\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\r\n", - "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\r\n LogicalJoin(condition=[=($4, $9)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(\"F1\".\"C0\"=[$5])\r\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDecorrelateAggWithConstantGroupKey.json b/tests/RelOptRulesTest/testDecorrelateAggWithConstantGroupKey.json deleted file mode 100644 index aba5e36..0000000 --- a/tests/RelOptRulesTest/testDecorrelateAggWithConstantGroupKey.json +++ /dev/null @@ -1,820 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "correlate": [ - { - "scan": 0 - }, - { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 11, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "CHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 11, - "type": "INTEGER" - }, - { - "operator": "_ISO-8859-1'abc'", - "operand": [], - "type": "CHAR" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 14, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 13, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 11, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 10, - "type": "CHAR" - }, - { - "column": 12, - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 13, - "type": "INTEGER" - }, - { - "operator": "_ISO-8859-1'abc'", - "operand": [], - "type": "CHAR" - }, - { - "column": 12, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 11, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 11, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - }, - { - "column": 18, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 12, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 10, - "type": "INTEGER" - }, - { - "column": 11, - "type": "CHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 12, - "type": "INTEGER" - }, - { - "operator": "_ISO-8859-1'abc'", - "operand": [], - "type": "CHAR" - }, - { - "column": 11, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 10, - "type": "INTEGER" - }, - { - "column": 15, - "type": "INTEGER" - }, - { - "column": 17, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 14, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 10, - "type": "INTEGER" - }, - { - "column": 12, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 11, - "type": "CHAR" - }, - { - "column": 13, - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 14, - "type": "INTEGER" - }, - { - "operator": "_ISO-8859-1'abc'", - "operand": [], - "type": "CHAR" - }, - { - "column": 13, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 12, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 12, - "type": "INTEGER" - }, - { - "column": 17, - "type": "INTEGER" - }, - { - "column": 19, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - } - ] - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{3, 5}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[=($cor0.SAL, $0)])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(EXPR$0=[$2])\r\n LogicalAggregate(group=[{0, 1}], EXPR$0=[MAX($2)])\r\n LogicalProject(DEPTNO=[$2], $f1=['abc'], SAL=[$1])\r\n LogicalFilter(condition=[=($cor0.MGR, $0)])\r\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalJoin(condition=[AND(=($3, $10), =($5, $9))], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EXPR$0=[$2], EMPNO=[$1])\r\n LogicalAggregate(group=[{0, 1}], EXPR$0=[MAX($2)])\r\n LogicalProject(DEPTNO=[$2], EMPNO=[$0], SAL=[$1])\r\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDecorrelateExists.json b/tests/RelOptRulesTest/testDecorrelateExists.json deleted file mode 100644 index f45b645..0000000 --- a/tests/RelOptRulesTest/testDecorrelateExists.json +++ /dev/null @@ -1,262 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "EXISTS", - "operand": [], - "query": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 8, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[EXISTS({\nLogicalFilter(condition=[=($cor0.DEPTNO, $7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n})], variablesSet=[[$cor0]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDecorrelateTwoExists.json b/tests/RelOptRulesTest/testDecorrelateTwoExists.json deleted file mode 100644 index 4901dd2..0000000 --- a/tests/RelOptRulesTest/testDecorrelateTwoExists.json +++ /dev/null @@ -1,506 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "EXISTS", - "operand": [], - "query": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "type": "BOOLEAN" - }, - { - "operator": "NOT", - "operand": [ - { - "operator": "EXISTS", - "operand": [], - "query": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 11, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 14, - "type": "INTEGER" - }, - { - "operator": "34", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NULL", - "operand": [ - { - "column": 11, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 8, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "34", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "34", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[AND(EXISTS({\nLogicalFilter(condition=[=($cor0.DEPTNO, $7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n}), NOT(EXISTS({\nLogicalFilter(condition=[AND(=($2, $cor0.JOB), =($5, 34))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n})))], variablesSet=[[$cor0]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[IS NULL($11)])\r\n LogicalJoin(condition=[=($2, $10)], joinType=[left])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(JOB=[$0], $f1=[true])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(JOB=[$0])\r\n LogicalFilter(condition=[=($1, 34)])\r\n LogicalProject(JOB=[$2], SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDecorrelateTwoIn.json b/tests/RelOptRulesTest/testDecorrelateTwoIn.json deleted file mode 100644 index 5e918be..0000000 --- a/tests/RelOptRulesTest/testDecorrelateTwoIn.json +++ /dev/null @@ -1,333 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "IN", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - }, - "type": "BOOLEAN" - }, - { - "operator": "IN", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 7, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(SAL=[$3])\r\n LogicalFilter(condition=[AND(IN($0, {\nLogicalProject(DEPTNO=[$0])\r\n LogicalFilter(condition=[=($cor0.JOB, $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n}), IN($0, {\nLogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[=($cor0.ENAME, $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n}))], variablesSet=[[$cor0]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(SAL=[$3])\r\n LogicalJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner])\r\n LogicalJoin(condition=[AND(=($2, $5), =($0, $4))], joinType=[inner])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDecorrelateUncorrelatedInAndCorrelatedExists.json b/tests/RelOptRulesTest/testDecorrelateUncorrelatedInAndCorrelatedExists.json deleted file mode 100644 index b3b6d96..0000000 --- a/tests/RelOptRulesTest/testDecorrelateUncorrelatedInAndCorrelatedExists.json +++ /dev/null @@ -1,466 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "IN", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "query": { - "project": { - "target": [ - { - "column": 11, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 14, - "type": "INTEGER" - }, - { - "operator": "34", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "type": "BOOLEAN" - }, - { - "operator": "EXISTS", - "operand": [], - "query": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 9, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "34", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "34", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 8, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[AND(IN($2, {\nLogicalProject(JOB=[$2])\r\n LogicalFilter(condition=[=($5, 34)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n}), EXISTS({\nLogicalFilter(condition=[=($cor0.DEPTNO, $7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n}))], variablesSet=[[$cor0]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalJoin(condition=[=($7, $10)], joinType=[inner])\r\n LogicalJoin(condition=[=($2, $9)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(JOB=[$0])\r\n LogicalFilter(condition=[=($1, 34)])\r\n LogicalProject(JOB=[$2], SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDigestOfApproximateDistinctAggregateCall.json b/tests/RelOptRulesTest/testDigestOfApproximateDistinctAggregateCall.json deleted file mode 100644 index 9f0ff8f..0000000 --- a/tests/RelOptRulesTest/testDigestOfApproximateDistinctAggregateCall.json +++ /dev/null @@ -1,351 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - }, - { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ] - } - ], - "help": [ - "LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\r\n LogicalProject(DEPTNO=[$1], EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT(APPROXIMATE DISTINCT $1)])\r\n LogicalProject(DEPTNO=[$1], EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{1}], EXPR$1=[COUNT(DISTINCT $0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{1}], EXPR$1=[COUNT(APPROXIMATE DISTINCT $0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctCount1.json b/tests/RelOptRulesTest/testDistinctCount1.json deleted file mode 100644 index 806e444..0000000 --- a/tests/RelOptRulesTest/testDistinctCount1.json +++ /dev/null @@ -1,310 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\r\n LogicalProject(DEPTNO=[$1], ENAME=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctCount2.json b/tests/RelOptRulesTest/testDistinctCount2.json deleted file mode 100644 index da6726c..0000000 --- a/tests/RelOptRulesTest/testDistinctCount2.json +++ /dev/null @@ -1,572 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "BIGINT" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[SUM($2)])\r\n LogicalProject(DEPTNO=[$2], ENAME=[$0], SAL=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[CAST($2):INTEGER NOT NULL])\r\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1) FILTER $3], EXPR$2=[MIN($2) FILTER $4])\r\n LogicalProject(DEPTNO=[$0], ENAME=[$1], EXPR$2=[$2], $g_0=[=($3, 0)], $g_1=[=($3, 1)])\r\n LogicalProject(DEPTNO=[$1], ENAME=[$0], EXPR$2=[$2], $g=[$3])\r\n LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {2}]], EXPR$2=[SUM($1)], $g=[GROUPING($2, $0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctCount3.json b/tests/RelOptRulesTest/testDistinctCount3.json deleted file mode 100644 index 29c90aa..0000000 --- a/tests/RelOptRulesTest/testDistinctCount3.json +++ /dev/null @@ -1,496 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$1], EXPR$1=[$2])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT(DISTINCT $0)], EXPR$1=[SUM($1)])\r\n LogicalProject(DEPTNO=[$1], SAL=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[$1], EXPR$1=[CAST($2):INTEGER NOT NULL])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT() FILTER $2], EXPR$1=[MIN($1) FILTER $2])\r\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $g_0=[=($2, 0)])\r\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], $g=[GROUPING($0)])\r\n LogicalProject(DEPTNO=[$1], SAL=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctCountGroupingSets1.json b/tests/RelOptRulesTest/testDistinctCountGroupingSets1.json deleted file mode 100644 index 1746fea..0000000 --- a/tests/RelOptRulesTest/testDistinctCountGroupingSets1.json +++ /dev/null @@ -1,565 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "GROUPING", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "GROUPING", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "VARCHAR" - }, - { - "column": 7, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 7, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 6, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT(DISTINCT $2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$1], ENAME=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT() FILTER $2])\r\n LogicalProject(DEPTNO=[$0], JOB=[$1], $g_0=[=($3, 0)])\r\n LogicalAggregate(group=[{0, 1, 2}], $g=[GROUPING($0, $1, $2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$1], ENAME=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctCountGroupingSets2.json b/tests/RelOptRulesTest/testDistinctCountGroupingSets2.json deleted file mode 100644 index f6dd522..0000000 --- a/tests/RelOptRulesTest/testDistinctCountGroupingSets2.json +++ /dev/null @@ -1,719 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 6, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 6, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 8, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "VARCHAR" - }, - { - "column": 7, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 7, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 8, - "type": "INTEGER" - }, - { - "column": 6, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT(DISTINCT $2)], EXPR$3=[SUM($3)])\r\n LogicalProject(DEPTNO=[$3], JOB=[$1], ENAME=[$0], SAL=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], JOB=[$1], EXPR$2=[$2], EXPR$3=[CAST($3):INTEGER NOT NULL])\r\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT($2) FILTER $4], EXPR$3=[MIN($3) FILTER $5])\r\n LogicalProject(DEPTNO=[$0], JOB=[$1], ENAME=[$2], EXPR$3=[$3], $g_0=[=($4, 0)], $g_1=[=($4, 1)])\r\n LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1, 2}, {0, 1}]], EXPR$3=[SUM($3)], $g=[GROUPING($0, $1, $2)])\r\n LogicalProject(DEPTNO=[$3], JOB=[$1], ENAME=[$0], SAL=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctCountMixed.json b/tests/RelOptRulesTest/testDistinctCountMixed.json deleted file mode 100644 index d11ed75..0000000 --- a/tests/RelOptRulesTest/testDistinctCountMixed.json +++ /dev/null @@ -1,604 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "BIGINT" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], CDDJ=[COUNT(DISTINCT $0, $1)], S=[SUM($2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$0], SAL=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], CDDJ=[$1], S=[CAST($2):INTEGER NOT NULL])\r\n LogicalAggregate(group=[{0}], CDDJ=[COUNT($1) FILTER $3], S=[MIN($2) FILTER $4])\r\n LogicalProject(DEPTNO=[$0], JOB=[$1], S=[$2], $g_0=[=($3, 0)], $g_1=[=($3, 1)])\r\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]], S=[SUM($2)], $g=[GROUPING($0, $1)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$0], SAL=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctCountMixed2.json b/tests/RelOptRulesTest/testDistinctCountMixed2.json deleted file mode 100644 index da4aa9d..0000000 --- a/tests/RelOptRulesTest/testDistinctCountMixed2.json +++ /dev/null @@ -1,719 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 2, - "type": "BIGINT" - }, - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], CDE=[COUNT(DISTINCT $1)], CDJE=[COUNT(DISTINCT $2, $1)], CDDJ=[COUNT(DISTINCT $0, $2)], S=[SUM($3)])\r\n LogicalProject(DEPTNO=[$3], ENAME=[$0], JOB=[$1], SAL=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], CDE=[$1], CDJE=[$2], CDDJ=[$3], S=[CAST($4):INTEGER NOT NULL])\r\n LogicalAggregate(group=[{0}], CDE=[COUNT($1) FILTER $5], CDJE=[COUNT($2, $1) FILTER $4], CDDJ=[COUNT($2) FILTER $6], S=[MIN($3) FILTER $7])\r\n LogicalProject(DEPTNO=[$2], ENAME=[$0], JOB=[$1], S=[$3], $g_0=[=($4, 0)], $g_1=[=($4, 1)], $g_2=[=($4, 2)], $g_3=[=($4, 3)])\r\n LogicalAggregate(group=[{0, 1, 3}], groups=[[{0, 1, 3}, {0, 3}, {1, 3}, {3}]], S=[SUM($2)], $g=[GROUPING($3, $0, $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctCountMixedJoin.json b/tests/RelOptRulesTest/testDistinctCountMixedJoin.json deleted file mode 100644 index b524628..0000000 --- a/tests/RelOptRulesTest/testDistinctCountMixedJoin.json +++ /dev/null @@ -1,1153 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - }, - { - "column": 5, - "type": "BIGINT" - }, - { - "column": 7, - "type": "BIGINT" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "IS NOT DISTINCT FROM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "IS NOT DISTINCT FROM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "IS NOT DISTINCT FROM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[COUNT(DISTINCT $2, $1)], EXPR$3=[COUNT(DISTINCT $0, $2)], EXPR$4=[SUM($3)])\r\n LogicalProject(DEPTNO=[$3], ENAME=[$0], JOB=[$1], SAL=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], EXPR$1=[$3], EXPR$2=[$5], EXPR$3=[$7], EXPR$4=[$1])\r\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $6)], joinType=[inner])\r\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner])\r\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner])\r\n LogicalAggregate(group=[{1}], EXPR$4=[SUM($0)])\r\n LogicalProject(SAL=[$2], DEPTNO=[$3])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(ENAME=[$0], DEPTNO=[$3])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{2}], EXPR$2=[COUNT()])\r\n LogicalAggregate(group=[{0, 1, 2}])\r\n LogicalProject(ENAME=[$0], JOB=[$1], DEPTNO=[$3])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{1}], EXPR$3=[COUNT()])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(JOB=[$1], DEPTNO=[$3])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctCountMultiple.json b/tests/RelOptRulesTest/testDistinctCountMultiple.json deleted file mode 100644 index 988f93c..0000000 --- a/tests/RelOptRulesTest/testDistinctCountMultiple.json +++ /dev/null @@ -1,568 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "GROUPING", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "GROUPING", - "operand": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[COUNT(DISTINCT $2)])\r\n LogicalProject(DEPTNO=[$2], ENAME=[$0], JOB=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1) FILTER $3], EXPR$2=[COUNT($2) FILTER $4])\r\n LogicalProject(DEPTNO=[$0], ENAME=[$1], JOB=[$2], $g_1=[=($3, 1)], $g_2=[=($3, 2)])\r\n LogicalProject(DEPTNO=[$2], ENAME=[$0], JOB=[$1], $g=[$3])\r\n LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 2}, {1, 2}]], $g=[GROUPING($2, $0, $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctCountMultipleNoGroup.json b/tests/RelOptRulesTest/testDistinctCountMultipleNoGroup.json deleted file mode 100644 index 59cf1e3..0000000 --- a/tests/RelOptRulesTest/testDistinctCountMultipleNoGroup.json +++ /dev/null @@ -1,393 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB" - ], - "types": [ - "VARCHAR", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "GROUPING", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "GROUPING", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[COUNT(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[COUNT($0) FILTER $2], EXPR$1=[COUNT($1) FILTER $3])\r\n LogicalProject(ENAME=[$0], JOB=[$1], $g_1=[=($2, 1)], $g_2=[=($2, 2)])\r\n LogicalAggregate(group=[{0, 1}], groups=[[{0}, {1}]], $g=[GROUPING($0, $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctCountMultipleViaJoin.json b/tests/RelOptRulesTest/testDistinctCountMultipleViaJoin.json deleted file mode 100644 index b524628..0000000 --- a/tests/RelOptRulesTest/testDistinctCountMultipleViaJoin.json +++ /dev/null @@ -1,1153 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - }, - { - "column": 5, - "type": "BIGINT" - }, - { - "column": 7, - "type": "BIGINT" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "IS NOT DISTINCT FROM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "IS NOT DISTINCT FROM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "IS NOT DISTINCT FROM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[COUNT(DISTINCT $2, $1)], EXPR$3=[COUNT(DISTINCT $0, $2)], EXPR$4=[SUM($3)])\r\n LogicalProject(DEPTNO=[$3], ENAME=[$0], JOB=[$1], SAL=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], EXPR$1=[$3], EXPR$2=[$5], EXPR$3=[$7], EXPR$4=[$1])\r\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $6)], joinType=[inner])\r\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner])\r\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner])\r\n LogicalAggregate(group=[{1}], EXPR$4=[SUM($0)])\r\n LogicalProject(SAL=[$2], DEPTNO=[$3])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(ENAME=[$0], DEPTNO=[$3])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{2}], EXPR$2=[COUNT()])\r\n LogicalAggregate(group=[{0, 1, 2}])\r\n LogicalProject(ENAME=[$0], JOB=[$1], DEPTNO=[$3])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{1}], EXPR$3=[COUNT()])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(JOB=[$1], DEPTNO=[$3])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctCountWithExpandSumType.json b/tests/RelOptRulesTest/testDistinctCountWithExpandSumType.json deleted file mode 100644 index 420c0b5..0000000 --- a/tests/RelOptRulesTest/testDistinctCountWithExpandSumType.json +++ /dev/null @@ -1,258 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "COMM" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "operator": "CAST", - "operand": [ - { - "column": 0, - "type": "DECIMAL" - } - ], - "type": "BIGINT" - }, - { - "column": 1, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 1, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "DECIMAL" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[COUNT()], EXPR$1=[COUNT(DISTINCT $0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[CAST($0):BIGINT NOT NULL], EXPR$1=[$1])\r\n LogicalAggregate(group=[{}], EXPR$0=[$SUM0($1)], EXPR$1=[COUNT()])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctCountWithoutGroupBy.json b/tests/RelOptRulesTest/testDistinctCountWithoutGroupBy.json deleted file mode 100644 index aa88dc9..0000000 --- a/tests/RelOptRulesTest/testDistinctCountWithoutGroupBy.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[MAX($0)], EXPR$1=[COUNT(DISTINCT $1)])\r\n LogicalProject(DEPTNO=[$1], ENAME=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[MIN($1) FILTER $3], EXPR$1=[COUNT($0) FILTER $2])\r\n LogicalProject(ENAME=[$0], EXPR$0=[$1], $g_0=[=($2, 0)], $g_1=[=($2, 1)])\r\n LogicalAggregate(group=[{0}], groups=[[{0}, {}]], EXPR$0=[MAX($1)], $g=[GROUPING($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctNonDistinctAggregates.json b/tests/RelOptRulesTest/testDistinctNonDistinctAggregates.json deleted file mode 100644 index d75f89c..0000000 --- a/tests/RelOptRulesTest/testDistinctNonDistinctAggregates.json +++ /dev/null @@ -1,560 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "AVG", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 3, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "AVG", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT()], EXPR$2=[AVG(DISTINCT $1)])\r\n LogicalProject(EMPNO=[$0], DEPTNO0=[$2])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($2)], EXPR$2=[AVG($1)])\r\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT()])\r\n LogicalProject(EMPNO=[$0], DEPTNO0=[$2])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctNonDistinctAggregatesWithGrouping1.json b/tests/RelOptRulesTest/testDistinctNonDistinctAggregatesWithGrouping1.json deleted file mode 100644 index 78f5ae6..0000000 --- a/tests/RelOptRulesTest/testDistinctNonDistinctAggregatesWithGrouping1.json +++ /dev/null @@ -1,544 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($0)], EXPR$2=[SUM(DISTINCT $1)], EXPR$3=[MAX($0)], EXPR$4=[MAX($2)])\r\n LogicalProject(DEPTNO=[$2], SAL=[$0], COMM=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($2)], EXPR$2=[SUM($1)], EXPR$3=[MAX($3)], EXPR$4=[MAX($4)])\r\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM($0)], EXPR$3=[MAX($0)], EXPR$4=[MAX($2)])\r\n LogicalProject(DEPTNO=[$2], SAL=[$0], COMM=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctNonDistinctAggregatesWithGrouping2.json b/tests/RelOptRulesTest/testDistinctNonDistinctAggregatesWithGrouping2.json deleted file mode 100644 index 45ce273..0000000 --- a/tests/RelOptRulesTest/testDistinctNonDistinctAggregatesWithGrouping2.json +++ /dev/null @@ -1,406 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 3, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT()], EXPR$2=[SUM(DISTINCT $1)])\r\n LogicalProject(DEPTNO=[$1], SAL=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($2)], EXPR$2=[SUM($1)])\r\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT()])\r\n LogicalProject(DEPTNO=[$1], SAL=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctNonDistinctTwoAggregatesWithGrouping.json b/tests/RelOptRulesTest/testDistinctNonDistinctTwoAggregatesWithGrouping.json deleted file mode 100644 index ae8280f..0000000 --- a/tests/RelOptRulesTest/testDistinctNonDistinctTwoAggregatesWithGrouping.json +++ /dev/null @@ -1,496 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[SUM(DISTINCT $2)])\r\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($2)], EXPR$2=[MIN($3)], EXPR$3=[SUM($1)])\r\n LogicalAggregate(group=[{0, 2}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\r\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctWithDiffFiltersAndSameGroupSet.json b/tests/RelOptRulesTest/testDistinctWithDiffFiltersAndSameGroupSet.json deleted file mode 100644 index 1f721db..0000000 --- a/tests/RelOptRulesTest/testDistinctWithDiffFiltersAndSameGroupSet.json +++ /dev/null @@ -1,620 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "500", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 0, - "type": "BOOLEAN" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "500", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 0, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "500", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "GROUPING", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - }, - { - "column": 3, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - }, - { - "column": 3, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "500", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 0, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "500", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "GROUPING", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - }, - { - "column": 3, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - }, - { - "column": 3, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "500", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[COUNT(DISTINCT $0) FILTER $1], EXPR$1=[COUNT(DISTINCT $1) FILTER $0])\r\n LogicalProject(C=[>($0, 1000)], D=[<($0, 500)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[COUNT() FILTER $1], EXPR$1=[COUNT() FILTER $0])\r\n LogicalProject($g_0_f_0=[AND(=($2, 0), $0)], $g_0_f_1=[AND(=($2, 0), $1)])\r\n LogicalAggregate(group=[{0, 1}], $g=[GROUPING($0, $1)])\r\n LogicalProject(C=[>($0, 1000)], D=[<($0, 500)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctWithFilterAndGroupBy.json b/tests/RelOptRulesTest/testDistinctWithFilterAndGroupBy.json deleted file mode 100644 index 50e8c36..0000000 --- a/tests/RelOptRulesTest/testDistinctWithFilterAndGroupBy.json +++ /dev/null @@ -1,766 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 2, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - }, - { - "column": 6, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "column": 3, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BOOLEAN" - }, - { - "column": 7, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT(DISTINCT $2) FILTER $3])\r\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0], $f3=[>($0, 1000)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], EXPR$1=[CAST($1):INTEGER NOT NULL], EXPR$2=[$2])\r\n LogicalAggregate(group=[{0}], EXPR$1=[MIN($2) FILTER $4], EXPR$2=[COUNT($1) FILTER $3])\r\n LogicalProject(DEPTNO=[$0], SAL=[$1], EXPR$1=[$3], $g_0_f_2=[AND(=($4, 0), IS TRUE($2))], $g_3=[=($4, 3)])\r\n LogicalAggregate(group=[{0, 2, 3}], groups=[[{0, 2, 3}, {0}]], EXPR$1=[SUM($1)], $g=[GROUPING($0, $2, $3)])\r\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0], $f3=[>($0, 1000)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctWithFilterWithoutGroupBy.json b/tests/RelOptRulesTest/testDistinctWithFilterWithoutGroupBy.json deleted file mode 100644 index 0b669e2..0000000 --- a/tests/RelOptRulesTest/testDistinctWithFilterWithoutGroupBy.json +++ /dev/null @@ -1,623 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL", - "COMM" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - }, - { - "column": 4, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - }, - { - "column": 4, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT(DISTINCT $1) FILTER $2])\r\n LogicalProject(COMM=[$1], SAL=[$0], $f2=[>($0, 1000)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[MIN($1) FILTER $3], EXPR$1=[COUNT($0) FILTER $2])\r\n LogicalProject(SAL=[$0], EXPR$0=[$2], $g_0_f_1=[AND(=($3, 0), IS TRUE($1))], $g_3=[=($3, 3)])\r\n LogicalAggregate(group=[{1, 2}], groups=[[{1, 2}, {}]], EXPR$0=[SUM($0)], $g=[GROUPING($1, $2)])\r\n LogicalProject(COMM=[$1], SAL=[$0], $f2=[>($0, 1000)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctWithGrouping.json b/tests/RelOptRulesTest/testDistinctWithGrouping.json deleted file mode 100644 index bba3145..0000000 --- a/tests/RelOptRulesTest/testDistinctWithGrouping.json +++ /dev/null @@ -1,349 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL", - "COMM" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[SUM(DISTINCT $0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($2)], EXPR$3=[SUM($0)])\r\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctWithMultipleInputs.json b/tests/RelOptRulesTest/testDistinctWithMultipleInputs.json deleted file mode 100644 index e8e1fb0..0000000 --- a/tests/RelOptRulesTest/testDistinctWithMultipleInputs.json +++ /dev/null @@ -1,531 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[COUNT(DISTINCT $2, $1)])\r\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($3)], EXPR$2=[MIN($4)], EXPR$3=[COUNT()])\r\n LogicalAggregate(group=[{0, 1, 2}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\r\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testDistinctWithMultipleInputsAndGroupby.json b/tests/RelOptRulesTest/testDistinctWithMultipleInputsAndGroupby.json deleted file mode 100644 index e7bd132..0000000 --- a/tests/RelOptRulesTest/testDistinctWithMultipleInputsAndGroupby.json +++ /dev/null @@ -1,535 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[COUNT(DISTINCT $2, $0, $1)])\r\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($3)], EXPR$2=[MIN($4)], EXPR$3=[COUNT()])\r\n LogicalAggregate(group=[{0, 1, 2}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\r\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testEmptyAggregate.json b/tests/RelOptRulesTest/testEmptyAggregate.json deleted file mode 100644 index b1de39a..0000000 --- a/tests/RelOptRulesTest/testEmptyAggregate.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [] - } - } - } - } - } - } - ] - } - } - } - }, - { - "values": { - "schema": [ - "INTEGER" - ], - "content": [] - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$1])\r\n LogicalAggregate(group=[{0}], EXPR$0=[SUM($1)])\r\n LogicalValues(tuples=[[]])\r\n", - "LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json b/tests/RelOptRulesTest/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json deleted file mode 100644 index 9a2ebd3..0000000 --- a/tests/RelOptRulesTest/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "values": { - "schema": [ - "INTEGER" - ], - "content": [] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "values": { - "schema": [ - "INTEGER" - ], - "content": [] - } - } - } - } - } - } - ] - } - }, - { - "values": { - "schema": [ - "BIGINT", - "INTEGER" - ], - "content": [ - [ - { - "operator": "0", - "operand": [], - "type": "BIGINT" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[COUNT()], EXPR$1=[SUM($0)])\r\n LogicalValues(tuples=[[]])\r\n", - "LogicalValues(tuples=[[{ 0, null }]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testEmptyFilterProjectUnion.json b/tests/RelOptRulesTest/testEmptyFilterProjectUnion.json deleted file mode 100644 index 3a37bb8..0000000 --- a/tests/RelOptRulesTest/testEmptyFilterProjectUnion.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - [ - { - "operator": "30", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "20", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - } - ] - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "30", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - } - ], - "help": [ - "LogicalProject(X=[$0], Y=[$1])\r\n LogicalFilter(condition=[>(+($0, $1), 30)])\r\n LogicalUnion(all=[true])\r\n LogicalProject(X=[$0], Y=[$1])\r\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\r\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\r\n LogicalValues(tuples=[[{ 20, 2 }]])\r\n", - "LogicalProject(X=[$0], Y=[$1])\r\n LogicalValues(tuples=[[{ 30, 3 }]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testEmptyIntersect.json b/tests/RelOptRulesTest/testEmptyIntersect.json deleted file mode 100644 index a2505af..0000000 --- a/tests/RelOptRulesTest/testEmptyIntersect.json +++ /dev/null @@ -1,165 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "intersect": [ - { - "intersect": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "30", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "50", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - [ - { - "operator": "30", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - } - } - } - ] - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "30", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - } - ] - }, - { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [] - } - } - ], - "help": [ - "LogicalIntersect(all=[false])\r\n LogicalIntersect(all=[false])\r\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\r\n LogicalValues(tuples=[[{ 30, 3 }]])\r\n LogicalProject(X=[$0], Y=[$1])\r\n LogicalFilter(condition=[>($0, 50)])\r\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\r\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\r\n LogicalValues(tuples=[[{ 30, 3 }]])\r\n", - "LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testEmptyMinus.json b/tests/RelOptRulesTest/testEmptyMinus.json deleted file mode 100644 index a03ba14..0000000 --- a/tests/RelOptRulesTest/testEmptyMinus.json +++ /dev/null @@ -1,157 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "distinct": { - "except": [ - { - "distinct": { - "except": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "30", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "20", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "40", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - } - ] - } - }, - { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [] - } - } - ], - "help": [ - "LogicalMinus(all=[false])\r\n LogicalMinus(all=[false])\r\n LogicalProject(X=[$0], Y=[$1])\r\n LogicalFilter(condition=[>($0, 30)])\r\n LogicalValues(tuples=[[{ 30, 3 }]])\r\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\r\n LogicalValues(tuples=[[{ 20, 2 }]])\r\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\r\n LogicalValues(tuples=[[{ 40, 4 }]])\r\n", - "LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testEmptyMinus2.json b/tests/RelOptRulesTest/testEmptyMinus2.json deleted file mode 100644 index 62fe111..0000000 --- a/tests/RelOptRulesTest/testEmptyMinus2.json +++ /dev/null @@ -1,287 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "distinct": { - "except": [ - { - "distinct": { - "except": [ - { - "distinct": { - "except": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "30", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "20", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "40", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "50", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "50", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "except": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "30", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "40", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalMinus(all=[false])\r\n LogicalMinus(all=[false])\r\n LogicalMinus(all=[false])\r\n LogicalProject(X=[$0], Y=[$1])\r\n LogicalValues(tuples=[[{ 30, 3 }]])\r\n LogicalProject(X=[$0], Y=[$1])\r\n LogicalFilter(condition=[>($0, 30)])\r\n LogicalValues(tuples=[[{ 20, 2 }]])\r\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\r\n LogicalValues(tuples=[[{ 40, 4 }]])\r\n LogicalProject(X=[$0], Y=[$1])\r\n LogicalFilter(condition=[>($0, 50)])\r\n LogicalValues(tuples=[[{ 50, 5 }]])\r\n", - "LogicalMinus(all=[false])\r\n LogicalProject(X=[$0], Y=[$1])\r\n LogicalValues(tuples=[[{ 30, 3 }]])\r\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\r\n LogicalValues(tuples=[[{ 40, 4 }]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testEmptyProject.json b/tests/RelOptRulesTest/testEmptyProject.json deleted file mode 100644 index 702984b..0000000 --- a/tests/RelOptRulesTest/testEmptyProject.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "50", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - [ - { - "operator": "30", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - } - } - }, - { - "values": { - "schema": [ - "INTEGER" - ], - "content": [] - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[+(+($0, $1), $0)])\r\n LogicalFilter(condition=[>(+($0, $1), 50)])\r\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\r\n", - "LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testEmptyProject2.json b/tests/RelOptRulesTest/testEmptyProject2.json deleted file mode 100644 index 702984b..0000000 --- a/tests/RelOptRulesTest/testEmptyProject2.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "50", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - [ - { - "operator": "30", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - } - } - }, - { - "values": { - "schema": [ - "INTEGER" - ], - "content": [] - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[+(+($0, $1), $0)])\r\n LogicalFilter(condition=[>(+($0, $1), 50)])\r\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\r\n", - "LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testEmptySort.json b/tests/RelOptRulesTest/testEmptySort.json deleted file mode 100644 index ff350b7..0000000 --- a/tests/RelOptRulesTest/testEmptySort.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "sort": { - "collation": [ - [ - 7, - "INTEGER", - "ASC" - ] - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "content": [] - } - } - ], - "help": [ - "LogicalSort(sort0=[$7], dir0=[ASC])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[false])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testEmptySort2.json b/tests/RelOptRulesTest/testEmptySort2.json deleted file mode 100644 index 268b425..0000000 --- a/tests/RelOptRulesTest/testEmptySort2.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "sort": { - "collation": [ - [ - 1, - "VARCHAR", - "ASC" - ], - [ - 0, - "TINYINT", - "ASC" - ] - ], - "source": { - "values": { - "schema": [ - "TINYINT", - "VARCHAR", - "VARCHAR" - ], - "content": [] - } - } - } - }, - { - "values": { - "schema": [ - "TINYINT", - "VARCHAR", - "VARCHAR" - ], - "content": [] - } - } - ], - "help": [ - "LogicalSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[ASC])\r\n LogicalValues(tuples=[[]])\r\n", - "LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testEmptySortLimitZero.json b/tests/RelOptRulesTest/testEmptySortLimitZero.json deleted file mode 100644 index 8048914..0000000 --- a/tests/RelOptRulesTest/testEmptySortLimitZero.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "sort": { - "collation": [ - [ - 7, - "INTEGER", - "ASC" - ] - ], - "limit": { - "operator": "0", - "operand": [], - "type": "INTEGER" - }, - "source": { - "scan": 0 - } - } - }, - { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "content": [] - } - } - ], - "help": [ - "LogicalSort(sort0=[$7], dir0=[ASC], fetch=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExistsWithAtLeastOneRowSubQuery.json b/tests/RelOptRulesTest/testExistsWithAtLeastOneRowSubQuery.json deleted file mode 100644 index 2602601..0000000 --- a/tests/RelOptRulesTest/testExistsWithAtLeastOneRowSubQuery.json +++ /dev/null @@ -1,199 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "EXISTS", - "operand": [], - "query": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - }, - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "scan": 0 - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0], NAME=[$1])\r\n LogicalFilter(condition=[EXISTS({\nLogicalAggregate(group=[{}], EXPR$0=[COUNT()])\r\n LogicalProject($f0=[0])\r\n LogicalFilter(condition=[=($cor0.DEPTNO, $7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n})], variablesSet=[[$cor0]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExistsWithNoRowSubQuery.json b/tests/RelOptRulesTest/testExistsWithNoRowSubQuery.json deleted file mode 100644 index c887a78..0000000 --- a/tests/RelOptRulesTest/testExistsWithNoRowSubQuery.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "NOT", - "operand": [ - { - "operator": "EXISTS", - "operand": [], - "query": { - "values": { - "schema": [ - "BIGINT" - ], - "content": [] - } - }, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "scan": 0 - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0], NAME=[$1])\r\n LogicalFilter(condition=[NOT(EXISTS({\nLogicalValues(tuples=[[]])\r\n}))])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExpandFilterExists.json b/tests/RelOptRulesTest/testExpandFilterExists.json deleted file mode 100644 index 08c72d0..0000000 --- a/tests/RelOptRulesTest/testExpandFilterExists.json +++ /dev/null @@ -1,334 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "EXISTS", - "operand": [], - "query": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[OR(EXISTS({\nLogicalFilter(condition=[<($0, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n}), <($1, 100))])\r\n LogicalProject(EMPNO=[$0], SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[OR(IS NOT NULL($2), <($1, 100))])\r\n LogicalJoin(condition=[true], joinType=[left])\r\n LogicalProject(EMPNO=[$0], SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(i=[true])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExpandFilterExistsSimple.json b/tests/RelOptRulesTest/testExpandFilterExistsSimple.json deleted file mode 100644 index cfa567f..0000000 --- a/tests/RelOptRulesTest/testExpandFilterExistsSimple.json +++ /dev/null @@ -1,260 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "EXISTS", - "operand": [], - "query": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalFilter(condition=[EXISTS({\nLogicalFilter(condition=[<($0, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n})])\r\n LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(i=[true])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExpandFilterExistsSimpleAnd.json b/tests/RelOptRulesTest/testExpandFilterExistsSimpleAnd.json deleted file mode 100644 index 2c433ae..0000000 --- a/tests/RelOptRulesTest/testExpandFilterExistsSimpleAnd.json +++ /dev/null @@ -1,318 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "EXISTS", - "operand": [], - "query": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[AND(EXISTS({\nLogicalFilter(condition=[<($0, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n}), <($1, 100))])\r\n LogicalProject(EMPNO=[$0], SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[<($1, 100)])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalProject(EMPNO=[$0], SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(i=[true])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExpandFilterIn.json b/tests/RelOptRulesTest/testExpandFilterIn.json deleted file mode 100644 index 801afa8..0000000 --- a/tests/RelOptRulesTest/testExpandFilterIn.json +++ /dev/null @@ -1,400 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "IN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "column": 10, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 4, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - }, - { - "column": 3, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[OR(IN($2, {\nLogicalProject(DEPTNO=[$7])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n}), <($1, 100))])\r\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[OR(IS NOT NULL($4), <($1, 100))])\r\n LogicalJoin(condition=[=($2, $3)], joinType=[left])\r\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(DEPTNO=[$1], i=[true])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExpandFilterIn3Value.json b/tests/RelOptRulesTest/testExpandFilterIn3Value.json deleted file mode 100644 index 844769b..0000000 --- a/tests/RelOptRulesTest/testExpandFilterIn3Value.json +++ /dev/null @@ -1,897 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "operator": "IN", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "type": "BOOLEAN" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "operator": "IN", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "type": "BOOLEAN" - }, - { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 5, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "column": 2, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 5, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "column": 2, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - }, - { - "column": 3, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[<($0, CASE(=(IN($1, {\nLogicalProject(EXPR$0=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n}), true), 10, =(IN($1, {\nLogicalProject(EXPR$0=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n}), false), 20, 30))])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[<($0, CASE(=(CASE(=($2, 0), false, IS NOT NULL($5), true, <($3, $2), null:BOOLEAN, false), true), 10, =(CASE(=($2, 0), false, IS NOT NULL($5), true, <($3, $2), null:BOOLEAN, false), false), 20, 30))])\r\n LogicalJoin(condition=[=($1, $4)], joinType=[left])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\r\n LogicalProject(EXPR$0=[CASE(true, CAST($1):INTEGER, null:INTEGER)])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(EXPR$0=[CASE(true, CAST($1):INTEGER, null:INTEGER)], i=[true])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExpandFilterInComposite.json b/tests/RelOptRulesTest/testExpandFilterInComposite.json deleted file mode 100644 index 8bc3b75..0000000 --- a/tests/RelOptRulesTest/testExpandFilterInComposite.json +++ /dev/null @@ -1,318 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "IN", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 5, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[OR(IN($0, $2, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n}), <($1, 100))])\r\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[OR(IS NOT NULL($5), <($1, 100))])\r\n LogicalJoin(condition=[AND(=($0, $3), =($2, $4))], joinType=[left])\r\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$1], i=[true])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExpandFilterScalar.json b/tests/RelOptRulesTest/testExpandFilterScalar.json deleted file mode 100644 index 654bd1c..0000000 --- a/tests/RelOptRulesTest/testExpandFilterScalar.json +++ /dev/null @@ -1,530 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "<", - "operand": [ - { - "operator": "$SCALAR_QUERY", - "operand": [], - "query": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "type": "INTEGER" - }, - { - "operator": "$SCALAR_QUERY", - "operand": [], - "query": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SINGLE_VALUE", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SINGLE_VALUE", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[OR(<($SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n}), $SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\r\n LogicalFilter(condition=[>($0, 100)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n})), <($1, 100))])\r\n LogicalProject(EMPNO=[$0], SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[OR(<($2, $3), <($1, 100))])\r\n LogicalJoin(condition=[true], joinType=[left])\r\n LogicalJoin(condition=[true], joinType=[left])\r\n LogicalProject(EMPNO=[$0], SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalFilter(condition=[>($0, 100)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExpandJoinExists.json b/tests/RelOptRulesTest/testExpandJoinExists.json deleted file mode 100644 index f9e4d20..0000000 --- a/tests/RelOptRulesTest/testExpandJoinExists.json +++ /dev/null @@ -1,330 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "EXISTS", - "operand": [], - "query": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalJoin(condition=[EXISTS({\nLogicalFilter(condition=[<($0, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n})], joinType=[left])\r\n LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalJoin(condition=[true], joinType=[left])\r\n LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(i=[true])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExpandJoinScalar.json b/tests/RelOptRulesTest/testExpandJoinScalar.json deleted file mode 100644 index 4418194..0000000 --- a/tests/RelOptRulesTest/testExpandJoinScalar.json +++ /dev/null @@ -1,531 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "<", - "operand": [ - { - "operator": "$SCALAR_QUERY", - "operand": [], - "query": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "type": "INTEGER" - }, - { - "operator": "$SCALAR_QUERY", - "operand": [], - "query": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SINGLE_VALUE", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SINGLE_VALUE", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalJoin(condition=[<($SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n}), $SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\r\n LogicalFilter(condition=[>($0, 100)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n}))], joinType=[left])\r\n LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalJoin(condition=[<($2, $3)], joinType=[left])\r\n LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalJoin(condition=[true], joinType=[left])\r\n LogicalJoin(condition=[true], joinType=[left])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalFilter(condition=[>($0, 100)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExpandProjectExists.json b/tests/RelOptRulesTest/testExpandProjectExists.json deleted file mode 100644 index e84a5a1..0000000 --- a/tests/RelOptRulesTest/testExpandProjectExists.json +++ /dev/null @@ -1,276 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "EXISTS", - "operand": [], - "query": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], D=[EXISTS({\nLogicalFilter(condition=[<($0, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n})])\r\n LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], D=[IS NOT NULL($1)])\r\n LogicalJoin(condition=[true], joinType=[left])\r\n LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(i=[true])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExpandProjectIn.json b/tests/RelOptRulesTest/testExpandProjectIn.json deleted file mode 100644 index e57e9b7..0000000 --- a/tests/RelOptRulesTest/testExpandProjectIn.json +++ /dev/null @@ -1,358 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "IN", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 3, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - }, - { - "column": 3, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], D=[IN($1, {\nLogicalProject(DEPTNO=[$7])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n})])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], D=[CASE(IS NOT NULL($3), true, false)])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(DEPTNO=[$1], i=[true])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExpandProjectInComposite.json b/tests/RelOptRulesTest/testExpandProjectInComposite.json deleted file mode 100644 index 8093ad2..0000000 --- a/tests/RelOptRulesTest/testExpandProjectInComposite.json +++ /dev/null @@ -1,276 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "IN", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 4, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], D=[IN($0, $1, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n})])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], D=[CASE(IS NOT NULL($4), true, false)])\r\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$1], i=[true])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExpandProjectInNullable.json b/tests/RelOptRulesTest/testExpandProjectInNullable.json deleted file mode 100644 index 5cf67a0..0000000 --- a/tests/RelOptRulesTest/testExpandProjectInNullable.json +++ /dev/null @@ -1,805 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "IN", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 5, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "column": 2, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - }, - { - "column": 3, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], D=[IN(CASE(true, CAST($1):INTEGER, null:INTEGER), {\nLogicalProject(DEPTNO=[$1])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n})])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], D=[CASE(=($2, 0), false, IS NULL(CASE(true, CAST($1):INTEGER, null:INTEGER)), null:BOOLEAN, IS NOT NULL($5), true, <($3, $2), null:BOOLEAN, false)])\r\n LogicalJoin(condition=[=(CASE(true, CAST($1):INTEGER, null:INTEGER), $4)], joinType=[left])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[CASE(true, CAST($1):INTEGER, null:INTEGER)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(DEPTNO=[$1], i=[true])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[CASE(true, CAST($1):INTEGER, null:INTEGER)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExpandProjectScalar.json b/tests/RelOptRulesTest/testExpandProjectScalar.json deleted file mode 100644 index 262e4b6..0000000 --- a/tests/RelOptRulesTest/testExpandProjectScalar.json +++ /dev/null @@ -1,265 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "$SCALAR_QUERY", - "operand": [], - "query": { - "project": { - "target": [ - { - "column": 8, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "join": { - "kind": "LEFT", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SINGLE_VALUE", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], D=[$SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n})])\r\n LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalJoin(condition=[true], joinType=[left])\r\n LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalFilter(condition=[<($0, 20)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExpandWhereComparisonCorrelated.json b/tests/RelOptRulesTest/testExpandWhereComparisonCorrelated.json deleted file mode 100644 index 35f04ae..0000000 --- a/tests/RelOptRulesTest/testExpandWhereComparisonCorrelated.json +++ /dev/null @@ -1,361 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "$SCALAR_QUERY", - "operand": [], - "query": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "correlate": [ - { - "scan": 0 - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "column": 10, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 14, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 10, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 14, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[=($1, $SCALAR_QUERY({\nLogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\r\n LogicalProject(SAL=[$5])\r\n LogicalFilter(condition=[=($0, $cor0.EMPNO)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n}))], variablesSet=[[$cor0]])\r\n LogicalProject(EMPNO=[$0], SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[=($5, $9)])\r\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\r\n LogicalProject(SAL=[$1])\r\n LogicalFilter(condition=[=($0, $cor0.EMPNO)])\r\n LogicalProject(EMPNO=[$0], SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExpressionSimplification1.json b/tests/RelOptRulesTest/testExpressionSimplification1.json deleted file mode 100644 index 583b3b4..0000000 --- a/tests/RelOptRulesTest/testExpressionSimplification1.json +++ /dev/null @@ -1,201 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "<>", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1''", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'3'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "SEARCH", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "Sarg[(-∞.._ISO-8859-1''), (_ISO-8859-1''.._ISO-8859-1'3'), (_ISO-8859-1'3'..+∞)]", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[AND(<>($1, ''), <>($1, '3'))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[SEARCH($1, Sarg[(-∞..'':VARCHAR(20)), ('':VARCHAR(20)..'3':VARCHAR(20)), ('3':VARCHAR(20)..+∞)]:VARCHAR(20))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExpressionSimplification2.json b/tests/RelOptRulesTest/testExpressionSimplification2.json deleted file mode 100644 index ca89aa2..0000000 --- a/tests/RelOptRulesTest/testExpressionSimplification2.json +++ /dev/null @@ -1,243 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1''", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1''", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "OR", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'3'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'3'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "SEARCH", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "Sarg[(-∞.._ISO-8859-1''), (_ISO-8859-1''.._ISO-8859-1'3'), (_ISO-8859-1'3'..+∞)]", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[AND(OR(<($1, ''), >($1, '')), OR(<($1, '3'), >($1, '3')))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[SEARCH($1, Sarg[(-∞..'':CHAR(1)), ('':CHAR(1)..'3'), ('3'..+∞)]:CHAR(1))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExtractJoinFilterRule.json b/tests/RelOptRulesTest/testExtractJoinFilterRule.json deleted file mode 100644 index 0114687..0000000 --- a/tests/RelOptRulesTest/testExtractJoinFilterRule.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalFilter(condition=[=($0, $1)])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExtractYearMonthToRange.json b/tests/RelOptRulesTest/testExtractYearMonthToRange.json deleted file mode 100644 index 2f04d12..0000000 --- a/tests/RelOptRulesTest/testExtractYearMonthToRange.json +++ /dev/null @@ -1,234 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP_B", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER", - "BIRTHDATE" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN", - "DATE" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "DATE" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "operator": "EXTRACT", - "operand": [ - { - "operator": "YEAR", - "operand": [], - "type": "SYMBOL" - }, - { - "column": 9, - "type": "DATE" - } - ], - "type": "BIGINT" - }, - { - "operator": "2014", - "operand": [], - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "operator": "EXTRACT", - "operand": [ - { - "operator": "MONTH", - "operand": [], - "type": "SYMBOL" - }, - { - "column": 9, - "type": "DATE" - } - ], - "type": "BIGINT" - }, - { - "operator": "4", - "operand": [], - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "DATE" - } - ], - "source": { - "filter": { - "condition": { - "operator": "SEARCH", - "operand": [ - { - "column": 9, - "type": "DATE" - }, - { - "operator": "Sarg[[2014-04-01..2014-05-01)]", - "operand": [], - "type": "DATE" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\r\n LogicalFilter(condition=[AND(=(EXTRACT(FLAG(YEAR), $9), 2014), =(EXTRACT(FLAG(MONTH), $9), 4))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\r\n LogicalFilter(condition=[SEARCH($9, Sarg[[2014-04-01..2014-05-01)])])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testExtractYearToRange.json b/tests/RelOptRulesTest/testExtractYearToRange.json deleted file mode 100644 index 6946457..0000000 --- a/tests/RelOptRulesTest/testExtractYearToRange.json +++ /dev/null @@ -1,202 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP_B", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER", - "BIRTHDATE" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN", - "DATE" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "DATE" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "operator": "EXTRACT", - "operand": [ - { - "operator": "YEAR", - "operand": [], - "type": "SYMBOL" - }, - { - "column": 9, - "type": "DATE" - } - ], - "type": "BIGINT" - }, - { - "operator": "2014", - "operand": [], - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "DATE" - } - ], - "source": { - "filter": { - "condition": { - "operator": "SEARCH", - "operand": [ - { - "column": 9, - "type": "DATE" - }, - { - "operator": "Sarg[[2014-01-01..2015-01-01)]", - "operand": [], - "type": "DATE" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\r\n LogicalFilter(condition=[=(EXTRACT(FLAG(YEAR), $9), 2014)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\r\n LogicalFilter(condition=[SEARCH($9, Sarg[[2014-01-01..2015-01-01)])])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testFilterJoinRuleAndIsNotNull.json b/tests/RelOptRulesTest/testFilterJoinRuleAndIsNotNull.json deleted file mode 100644 index 631e883..0000000 --- a/tests/RelOptRulesTest/testFilterJoinRuleAndIsNotNull.json +++ /dev/null @@ -1,315 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 10, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 10, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalFilter(condition=[AND(IS NOT NULL($9), IS NOT NULL($10))])\r\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[CAST($9):INTEGER], NAME=[CAST($10):VARCHAR(10)])\r\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testFilterJoinRuleOrIsNotNull.json b/tests/RelOptRulesTest/testFilterJoinRuleOrIsNotNull.json deleted file mode 100644 index 68f99ae..0000000 --- a/tests/RelOptRulesTest/testFilterJoinRuleOrIsNotNull.json +++ /dev/null @@ -1,315 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 10, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 10, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalFilter(condition=[OR(IS NOT NULL($9), IS NOT NULL($10))])\r\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[CAST($9):INTEGER], NAME=[CAST($10):VARCHAR(10)])\r\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testFilterProjectTranspose.json b/tests/RelOptRulesTest/testFilterProjectTranspose.json deleted file mode 100644 index 8e0900f..0000000 --- a/tests/RelOptRulesTest/testFilterProjectTranspose.json +++ /dev/null @@ -1,400 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 9, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "correlate": [ - { - "scan": 0 - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "*", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 9, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "*", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 9, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "correlate": [ - { - "scan": 0 - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 9, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[IS NOT NULL($9)])\r\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\r\n LogicalProject($f0=[true])\r\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\r\n LogicalProject(TWICEDEPTNO=[*($0, 2)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[IS NOT NULL($9)])\r\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\r\n LogicalProject($f0=[true])\r\n LogicalFilter(condition=[=($cor0.DEPTNO, *($0, 2))])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testFilterRemoveIsNotDistinctFromRule.json b/tests/RelOptRulesTest/testFilterRemoveIsNotDistinctFromRule.json deleted file mode 100644 index 806aa0a..0000000 --- a/tests/RelOptRulesTest/testFilterRemoveIsNotDistinctFromRule.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "SMALLINT", - "VARCHAR", - "VARCHAR", - "SMALLINT", - "DATE", - "DECIMAL", - "DECIMAL", - "TINYINT" - ], - "nullable": [ - false, - true, - true, - true, - true, - true, - true, - true - ], - "key": [ - [ - 0 - ], - [ - 1 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "IS NOT DISTINCT FROM", - "operand": [ - { - "column": 7, - "type": "TINYINT" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "TINYINT" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - ], - "help": [ - "LogicalFilter(condition=[IS NOT DISTINCT FROM($7, 20)])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n", - "LogicalFilter(condition=[=($7, 20)])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testFlattenUncorrelatedCallBelowEquals.json b/tests/RelOptRulesTest/testFlattenUncorrelatedCallBelowEquals.json deleted file mode 100644 index 9ccf419..0000000 --- a/tests/RelOptRulesTest/testFlattenUncorrelatedCallBelowEquals.json +++ /dev/null @@ -1,486 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 9, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "correlate": [ - { - "scan": 0 - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 16, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 9, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 16, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 9, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "correlate": [ - { - "scan": 0 - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 16, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 9, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 16, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[IS NOT NULL($9)])\r\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\r\n LogicalProject($f0=[true])\r\n LogicalFilter(condition=[=($cor0.DEPTNO, +($0, 30))])\r\n LogicalProject(DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[IS NOT NULL($9)])\r\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\r\n LogicalProject($f0=[true])\r\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\r\n LogicalProject($f9=[+($0, 30)])\r\n LogicalProject(DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json b/tests/RelOptRulesTest/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json deleted file mode 100644 index f3a6c19..0000000 --- a/tests/RelOptRulesTest/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json +++ /dev/null @@ -1,530 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 9, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "correlate": [ - { - "scan": 0 - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "*", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 16, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 9, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "*", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 16, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 9, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "correlate": [ - { - "scan": 0 - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "operator": "*", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 16, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 9, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "operator": "*", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 16, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[IS NOT NULL($9)])\r\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\r\n LogicalProject($f0=[true])\r\n LogicalFilter(condition=[=($cor0.DEPTNO, +(*(2, $0), 30))])\r\n LogicalProject(DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[IS NOT NULL($9)])\r\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\r\n LogicalProject($f0=[true])\r\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\r\n LogicalProject($f9=[+(*(2, $0), 30)])\r\n LogicalProject(DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testFullOuterJoinSimplificationToInner.json b/tests/RelOptRulesTest/testFullOuterJoinSimplificationToInner.json deleted file mode 100644 index 740b699..0000000 --- a/tests/RelOptRulesTest/testFullOuterJoinSimplificationToInner.json +++ /dev/null @@ -1,209 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'Charlie'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'Charlie'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalFilter(condition=[AND(=($1, 'Charlie'), >($2, 100))])\r\n LogicalJoin(condition=[=($0, $3)], joinType=[full])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalProject(DUMMY=[0])\r\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\r\n LogicalFilter(condition=[=($1, 'Charlie')])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalFilter(condition=[>($0, 100)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testFullOuterJoinSimplificationToLeftOuter.json b/tests/RelOptRulesTest/testFullOuterJoinSimplificationToLeftOuter.json deleted file mode 100644 index f9b1f6c..0000000 --- a/tests/RelOptRulesTest/testFullOuterJoinSimplificationToLeftOuter.json +++ /dev/null @@ -1,166 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'Charlie'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'Charlie'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalFilter(condition=[=($1, 'Charlie')])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[full])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalProject(DUMMY=[0])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\r\n LogicalFilter(condition=[=($1, 'Charlie')])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testFullOuterJoinSimplificationToRightOuter.json b/tests/RelOptRulesTest/testFullOuterJoinSimplificationToRightOuter.json deleted file mode 100644 index d4e9430..0000000 --- a/tests/RelOptRulesTest/testFullOuterJoinSimplificationToRightOuter.json +++ /dev/null @@ -1,166 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalFilter(condition=[>($1, 100)])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[full])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalProject(DUMMY=[0])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalFilter(condition=[>($0, 100)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testGroupByBooleanLiteralSimple.json b/tests/RelOptRulesTest/testGroupByBooleanLiteralSimple.json deleted file mode 100644 index 41d979c..0000000 --- a/tests/RelOptRulesTest/testGroupByBooleanLiteralSimple.json +++ /dev/null @@ -1,282 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "AVG", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "BOOLEAN" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "values": { - "schema": [ - "BOOLEAN" - ], - "content": [ - [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ] - ] - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "AVG", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "values": { - "schema": [ - "BOOLEAN" - ], - "content": [ - [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ] - ] - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$1])\r\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\r\n LogicalProject($f0=[true], SAL=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[$1])\r\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\r\n LogicalProject($f0=[$1], SAL=[$0])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalValues(tuples=[[{ true }]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testGroupByDateLiteralSimple.json b/tests/RelOptRulesTest/testGroupByDateLiteralSimple.json deleted file mode 100644 index a8ae4f7..0000000 --- a/tests/RelOptRulesTest/testGroupByDateLiteralSimple.json +++ /dev/null @@ -1,282 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "DATE" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", - "operand": [], - "type": "DATE" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "AVG", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "DATE" - }, - { - "column": 1, - "type": "DATE" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", - "operand": [], - "type": "DATE" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "DATE" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "DATE" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "values": { - "schema": [ - "DATE" - ], - "content": [ - [ - { - "operator": "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", - "operand": [], - "type": "DATE" - } - ] - ] - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "AVG", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "DATE" - }, - { - "column": 1, - "type": "DATE" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "DATE" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "values": { - "schema": [ - "DATE" - ], - "content": [ - [ - { - "operator": "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", - "operand": [], - "type": "DATE" - } - ] - ] - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$1])\r\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\r\n LogicalProject($f0=[2022-01-01], SAL=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[$1])\r\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\r\n LogicalProject($f0=[$1], SAL=[$0])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalValues(tuples=[[{ 2022-01-01 }]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testGroupByMultipleLiterals.json b/tests/RelOptRulesTest/testGroupByMultipleLiterals.json deleted file mode 100644 index 6eeb7f3..0000000 --- a/tests/RelOptRulesTest/testGroupByMultipleLiterals.json +++ /dev/null @@ -1,594 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BOOLEAN" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "CHAR" - }, - { - "column": 5, - "type": "DATE" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "_ISO-8859-1'ab'", - "operand": [], - "type": "CHAR" - }, - { - "operator": "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", - "operand": [], - "type": "DATE" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "AVG", - "operand": [ - { - "column": 12, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "BOOLEAN" - }, - { - "column": 6, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "CHAR" - }, - { - "column": 10, - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "DATE" - }, - { - "column": 11, - "type": "DATE" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - }, - { - "column": 8, - "type": "INTEGER" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "operator": "_ISO-8859-1'ab'", - "operand": [], - "type": "CHAR" - }, - { - "operator": "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", - "operand": [], - "type": "DATE" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BOOLEAN" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "CHAR" - }, - { - "column": 5, - "type": "DATE" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "BOOLEAN" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 5, - "type": "CHAR" - }, - { - "column": 6, - "type": "DATE" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "values": { - "schema": [ - "BOOLEAN", - "BOOLEAN", - "CHAR", - "DATE" - ], - "content": [ - [ - { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'ab'", - "operand": [], - "type": "CHAR" - }, - { - "operator": "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", - "operand": [], - "type": "DATE" - } - ] - ] - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "AVG", - "operand": [ - { - "column": 12, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "BOOLEAN" - }, - { - "column": 6, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "CHAR" - }, - { - "column": 10, - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "DATE" - }, - { - "column": 11, - "type": "DATE" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 9, - "type": "BOOLEAN" - }, - { - "column": 8, - "type": "INTEGER" - }, - { - "column": 10, - "type": "BOOLEAN" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 11, - "type": "CHAR" - }, - { - "column": 12, - "type": "DATE" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "values": { - "schema": [ - "BOOLEAN", - "BOOLEAN", - "CHAR", - "DATE" - ], - "content": [ - [ - { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'ab'", - "operand": [], - "type": "CHAR" - }, - { - "operator": "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", - "operand": [], - "type": "DATE" - } - ] - ] - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$6])\r\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5}], EXPR$0=[AVG($6)])\r\n LogicalProject($f0=[false], DEPTNO=[$2], $f2=[true], EMPNO=[$0], $f4=['ab'], $f5=[2022-01-01], SAL=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[$6])\r\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5}], EXPR$0=[AVG($6)])\r\n LogicalProject($f0=[$3], DEPTNO=[$2], $f2=[$4], EMPNO=[$0], $f4=[$5], $f5=[$6], SAL=[$1])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalValues(tuples=[[{ false, true, 'ab', 2022-01-01 }]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testInferringPredicatesWithNotOperatorInJoinCondition.json b/tests/RelOptRulesTest/testInferringPredicatesWithNotOperatorInJoinCondition.json deleted file mode 100644 index f2a7032..0000000 --- a/tests/RelOptRulesTest/testInferringPredicatesWithNotOperatorInJoinCondition.json +++ /dev/null @@ -1,371 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - }, - { - "column": 11, - "type": "VARCHAR" - }, - { - "column": 12, - "type": "INTEGER" - }, - { - "column": 13, - "type": "TIMESTAMP" - }, - { - "column": 14, - "type": "INTEGER" - }, - { - "column": 15, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - }, - { - "column": 17, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 16, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NOT", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "6", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - }, - { - "column": 11, - "type": "VARCHAR" - }, - { - "column": 12, - "type": "INTEGER" - }, - { - "column": 13, - "type": "TIMESTAMP" - }, - { - "column": 14, - "type": "INTEGER" - }, - { - "column": 15, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - }, - { - "column": 17, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 16, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "NOT", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "6", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "filter": { - "condition": { - "operator": "SEARCH", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "Sarg[(-∞..4), (4..6), (6..+∞)]", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\r\n LogicalJoin(condition=[AND(=($16, $7), NOT(OR(=($7, 4), =($7, 6))))], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\r\n LogicalJoin(condition=[=($16, $7)], joinType=[inner])\r\n LogicalFilter(condition=[NOT(OR(=($7, 4), =($7, 6)))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[SEARCH($7, Sarg[(-∞..4), (4..6), (6..+∞)])])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testIntersectToDistinct.json b/tests/RelOptRulesTest/testIntersectToDistinct.json deleted file mode 100644 index cf2e0e7..0000000 --- a/tests/RelOptRulesTest/testIntersectToDistinct.json +++ /dev/null @@ -1,902 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "intersect": [ - { - "intersect": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "3", - "operand": [], - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 11, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 12, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 13, - "type": "TIMESTAMP" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 14, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 15, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 17, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - }, - { - "column": 11, - "type": "VARCHAR" - }, - { - "column": 12, - "type": "INTEGER" - }, - { - "column": 13, - "type": "TIMESTAMP" - }, - { - "column": 14, - "type": "INTEGER" - }, - { - "column": 15, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - }, - { - "column": 17, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 16, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - }, - { - "column": 11, - "type": "VARCHAR" - }, - { - "column": 12, - "type": "INTEGER" - }, - { - "column": 13, - "type": "TIMESTAMP" - }, - { - "column": 14, - "type": "INTEGER" - }, - { - "column": 15, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - }, - { - "column": 17, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 16, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - }, - { - "column": 11, - "type": "VARCHAR" - }, - { - "column": 12, - "type": "INTEGER" - }, - { - "column": 13, - "type": "TIMESTAMP" - }, - { - "column": 14, - "type": "INTEGER" - }, - { - "column": 15, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - }, - { - "column": 17, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 16, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalIntersect(all=[false])\r\n LogicalIntersect(all=[false])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 30)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($9, 3)])\r\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5, 6, 7, 8}], agg#0=[COUNT()])\r\n LogicalUnion(all=[true])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 30)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testIsNullPushDown.json b/tests/RelOptRulesTest/testIsNullPushDown.json deleted file mode 100644 index be04093..0000000 --- a/tests/RelOptRulesTest/testIsNullPushDown.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "values": { - "schema": [ - "INTEGER", - "INTEGER", - "BIGINT" - ], - "content": [] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BIGINT" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER", - "BIGINT" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalValues(tuples=[[]])\r\n", - "LogicalProject(EMPNO=[$0], DEPTNO=[$1], W_COUNT=[$2])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testIsNullPushDown2.json b/tests/RelOptRulesTest/testIsNullPushDown2.json deleted file mode 100644 index be04093..0000000 --- a/tests/RelOptRulesTest/testIsNullPushDown2.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "values": { - "schema": [ - "INTEGER", - "INTEGER", - "BIGINT" - ], - "content": [] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BIGINT" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER", - "BIGINT" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalValues(tuples=[[]])\r\n", - "LogicalProject(EMPNO=[$0], DEPTNO=[$1], W_COUNT=[$2])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json b/tests/RelOptRulesTest/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json deleted file mode 100644 index d3e8913..0000000 --- a/tests/RelOptRulesTest/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json +++ /dev/null @@ -1,223 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "SMALLINT", - "VARCHAR", - "VARCHAR", - "SMALLINT", - "DATE", - "DECIMAL", - "DECIMAL", - "TINYINT" - ], - "nullable": [ - false, - true, - true, - true, - true, - true, - true, - true - ], - "key": [ - [ - 0 - ], - [ - 1 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "DNAME", - "LOC" - ], - "types": [ - "TINYINT", - "VARCHAR", - "VARCHAR" - ], - "nullable": [ - false, - true, - true - ], - "key": [ - [ - 0 - ], - [ - 1 - ], - [ - 2 - ] - ], - "guaranteed": [] - }, - { - "name": "BONUS", - "fields": [ - "ENAME", - "JOB", - "SAL", - "COMM" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "DECIMAL", - "DECIMAL" - ], - "nullable": [ - true, - true, - true, - true - ], - "key": [ - [ - 0 - ], - [ - 1 - ], - [ - 2 - ], - [ - 3 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 12, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "TINYINT" - }, - { - "column": 8, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "scan": 2 - } - } - }, - { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 12, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "TINYINT" - }, - { - "column": 8, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 1 - }, - "right": { - "scan": 2 - } - } - } - } - } - ], - "help": [ - "LogicalJoin(condition=[=($2, $12)], joinType=[inner])\r\n LogicalJoin(condition=[=($7, $8)], joinType=[inner])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n LogicalTableScan(table=[[scott, BONUS]])\r\n", - "LogicalJoin(condition=[AND(=($2, $12), =($7, $8))], joinType=[inner])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n LogicalTableScan(table=[[scott, BONUS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json b/tests/RelOptRulesTest/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json deleted file mode 100644 index bd404c2..0000000 --- a/tests/RelOptRulesTest/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json +++ /dev/null @@ -1,194 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "SMALLINT", - "VARCHAR", - "VARCHAR", - "SMALLINT", - "DATE", - "DECIMAL", - "DECIMAL", - "TINYINT" - ], - "nullable": [ - false, - true, - true, - true, - true, - true, - true, - true - ], - "key": [ - [ - 0 - ], - [ - 1 - ] - ], - "guaranteed": [] - }, - { - "name": "BONUS", - "fields": [ - "ENAME", - "JOB", - "SAL", - "COMM" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "DECIMAL", - "DECIMAL" - ], - "nullable": [ - true, - true, - true, - true - ], - "key": [ - [ - 0 - ], - [ - 1 - ], - [ - 2 - ], - [ - 3 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "DNAME", - "LOC" - ], - "types": [ - "TINYINT", - "VARCHAR", - "VARCHAR" - ], - "nullable": [ - false, - true, - true - ], - "key": [ - [ - 0 - ], - [ - 1 - ], - [ - 2 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "TINYINT" - }, - { - "column": 12, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "scan": 2 - } - } - }, - { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "TINYINT" - }, - { - "column": 12, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 1 - }, - "right": { - "scan": 2 - } - } - } - } - } - ], - "help": [ - "LogicalJoin(condition=[=($7, $12)], joinType=[inner])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n LogicalTableScan(table=[[scott, BONUS]])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n", - "LogicalJoin(condition=[=($7, $12)], joinType=[inner])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[scott, BONUS]])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json b/tests/RelOptRulesTest/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json deleted file mode 100644 index 436a21b..0000000 --- a/tests/RelOptRulesTest/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "SMALLINT", - "VARCHAR", - "VARCHAR", - "SMALLINT", - "DATE", - "DECIMAL", - "DECIMAL", - "TINYINT" - ], - "nullable": [ - false, - true, - true, - true, - true, - true, - true, - true - ], - "key": [ - [ - 0 - ], - [ - 1 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "DNAME", - "LOC" - ], - "types": [ - "TINYINT", - "VARCHAR", - "VARCHAR" - ], - "nullable": [ - false, - true, - true - ], - "key": [ - [ - 0 - ], - [ - 1 - ], - [ - 2 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - { - "project": { - "target": [ - { - "column": 3, - "type": "SMALLINT" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "SMALLINT" - }, - { - "column": 7, - "type": "DATE" - }, - { - "column": 8, - "type": "DECIMAL" - }, - { - "column": 9, - "type": "DECIMAL" - }, - { - "column": 10, - "type": "TINYINT" - }, - { - "column": 0, - "type": "TINYINT" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 1 - }, - "right": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n", - "LogicalProject(EMPNO=[$3], ENAME=[$4], JOB=[$5], MGR=[$6], HIREDATE=[$7], SAL=[$8], COMM=[$9], DEPTNO=[$10], DEPTNO0=[$0], DNAME=[$1], LOC=[$2])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testJoinConditionPushdown1.json b/tests/RelOptRulesTest/testJoinConditionPushdown1.json deleted file mode 100644 index 38eff53..0000000 --- a/tests/RelOptRulesTest/testJoinConditionPushdown1.json +++ /dev/null @@ -1,359 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - }, - { - "column": 11, - "type": "VARCHAR" - }, - { - "column": 12, - "type": "INTEGER" - }, - { - "column": 13, - "type": "TIMESTAMP" - }, - { - "column": 14, - "type": "INTEGER" - }, - { - "column": 15, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - }, - { - "column": 17, - "type": "BOOLEAN" - }, - { - "column": 18, - "type": "INTEGER" - }, - { - "column": 19, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 18, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 16, - "type": "INTEGER" - }, - { - "column": 18, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - }, - { - "column": 11, - "type": "VARCHAR" - }, - { - "column": 12, - "type": "INTEGER" - }, - { - "column": 13, - "type": "TIMESTAMP" - }, - { - "column": 14, - "type": "INTEGER" - }, - { - "column": 15, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - }, - { - "column": 17, - "type": "BOOLEAN" - }, - { - "column": 18, - "type": "INTEGER" - }, - { - "column": 19, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 18, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17], DEPTNO1=[$18], NAME=[$19])\r\n LogicalFilter(condition=[AND(=($7, $18), =($16, $18))])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17], DEPTNO1=[$18], NAME=[$19])\r\n LogicalJoin(condition=[=($7, $18)], joinType=[inner])\r\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testJoinConditionPushdown2.json b/tests/RelOptRulesTest/testJoinConditionPushdown2.json deleted file mode 100644 index d0444ec..0000000 --- a/tests/RelOptRulesTest/testJoinConditionPushdown2.json +++ /dev/null @@ -1,270 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalFilter(condition=[AND(=($7, $9), =($0, $9))])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\r\n LogicalFilter(condition=[=($7, $0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testJoinConditionPushdown4.json b/tests/RelOptRulesTest/testJoinConditionPushdown4.json deleted file mode 100644 index ebe442b..0000000 --- a/tests/RelOptRulesTest/testJoinConditionPushdown4.json +++ /dev/null @@ -1,163 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "DEPTNO" - ], - "types": [ - "SMALLINT", - "TINYINT" - ], - "nullable": [ - false, - true - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "DNAME" - ], - "types": [ - "TINYINT", - "VARCHAR" - ], - "nullable": [ - false, - true - ], - "key": [ - [ - 0 - ], - [ - 1 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "join": { - "kind": "SEMI", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "TINYINT" - }, - { - "column": 1, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "TINYINT" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "TINYINT" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "TINYINT" - } - ], - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "TINYINT" - }, - { - "column": 2, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "TINYINT" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalJoin(condition=[AND(=($0, $1), =($0, $2))], joinType=[semi])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n", - "LogicalProject(DEPTNO=[$1])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n LogicalFilter(condition=[=($0, $1)])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testJoinConditionPushdown6.json b/tests/RelOptRulesTest/testJoinConditionPushdown6.json deleted file mode 100644 index de046a5..0000000 --- a/tests/RelOptRulesTest/testJoinConditionPushdown6.json +++ /dev/null @@ -1,261 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalJoin(condition=[AND(=($7, $9), =($0, $9))], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\r\n LogicalFilter(condition=[=($7, $0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule1.json b/tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule1.json deleted file mode 100644 index 8041974..0000000 --- a/tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule1.json +++ /dev/null @@ -1,145 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "MGR", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - true, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(MGR=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalFilter(condition=[IS NOT NULL($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[IS NOT NULL($0)])\r\n LogicalProject(MGR=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule12.json b/tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule12.json deleted file mode 100644 index 0c20616..0000000 --- a/tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule12.json +++ /dev/null @@ -1,196 +0,0 @@ -{ - "schemas": [ - { - "name": "EMPNULLABLES", - "fields": [ - "ENAME", - "MGR", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - true, - true, - true - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT DISTINCT FROM", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT DISTINCT FROM", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$2])\r\n LogicalJoin(condition=[AND(=($0, $3), IS NOT DISTINCT FROM($1, $4))], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n LogicalProject(ENAME=[$0], MGR=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n", - "LogicalProject(DEPTNO=[$2])\r\n LogicalJoin(condition=[AND(=($0, $3), IS NOT DISTINCT FROM($1, $4))], joinType=[inner])\r\n LogicalFilter(condition=[IS NOT NULL($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n LogicalFilter(condition=[IS NOT NULL($0)])\r\n LogicalProject(ENAME=[$0], MGR=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule2.json b/tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule2.json deleted file mode 100644 index e6dcf8a..0000000 --- a/tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule2.json +++ /dev/null @@ -1,159 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "MGR", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - true, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalFilter(condition=[IS NOT NULL($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(MGR=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalFilter(condition=[IS NOT NULL($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[IS NOT NULL($0)])\r\n LogicalProject(MGR=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule3.json b/tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule3.json deleted file mode 100644 index 8dd8220..0000000 --- a/tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule3.json +++ /dev/null @@ -1,145 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "MGR", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - true, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$1])\r\n LogicalJoin(condition=[>($0, $2)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(MGR=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$1])\r\n LogicalJoin(condition=[>($0, $2)], joinType=[inner])\r\n LogicalFilter(condition=[IS NOT NULL($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[IS NOT NULL($0)])\r\n LogicalProject(MGR=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule4.json b/tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule4.json deleted file mode 100644 index 9b97fd5..0000000 --- a/tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule4.json +++ /dev/null @@ -1,228 +0,0 @@ -{ - "schemas": [ - { - "name": "EMPNULLABLES", - "fields": [ - "ENAME", - "MGR", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - true, - true, - true - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$2])\r\n LogicalJoin(condition=[AND(=($0, $3), >($1, $4))], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n LogicalProject(ENAME=[$0], MGR=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n", - "LogicalProject(DEPTNO=[$2])\r\n LogicalJoin(condition=[AND(=($0, $3), >($1, $4))], joinType=[inner])\r\n LogicalFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n LogicalFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])\r\n LogicalProject(ENAME=[$0], MGR=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule5.json b/tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule5.json deleted file mode 100644 index 1299414..0000000 --- a/tests/RelOptRulesTest/testJoinDeriveIsNotNullFilterRule5.json +++ /dev/null @@ -1,209 +0,0 @@ -{ - "schemas": [ - { - "name": "EMPNULLABLES", - "fields": [ - "ENAME", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - true, - true - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalProject(ENAME=[$0], DEPTNO=[+($1, 1)])\r\n LogicalFilter(condition=[IS NOT NULL($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n LogicalProject(ENAME=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n", - "LogicalProject(DEPTNO=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalProject(ENAME=[$0], DEPTNO=[+($1, 1)])\r\n LogicalFilter(condition=[IS NOT NULL($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n LogicalFilter(condition=[IS NOT NULL($0)])\r\n LogicalProject(ENAME=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testJoinProjectTranspose1.json b/tests/RelOptRulesTest/testJoinProjectTranspose1.json deleted file mode 100644 index 51ad128..0000000 --- a/tests/RelOptRulesTest/testJoinProjectTranspose1.json +++ /dev/null @@ -1,239 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "column": 1, - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "column": 1, - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "LEFT", - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(NAME=[$0])\r\n LogicalJoin(condition=[$1], joinType=[right])\r\n LogicalProject(NAME=[$0], $f4=[$2])\r\n LogicalJoin(condition=[$1], joinType=[left])\r\n LogicalProject(NAME=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject($f2=[>($0, 10)], $f4=[>($0, 10)])\r\n LogicalProject(DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(NAME=[$0])\r\n LogicalJoin(condition=[>($1, 10)], joinType=[right])\r\n LogicalJoin(condition=[>($1, 10)], joinType=[left])\r\n LogicalProject(NAME=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testJoinProjectTranspose7.json b/tests/RelOptRulesTest/testJoinProjectTranspose7.json deleted file mode 100644 index 4583377..0000000 --- a/tests/RelOptRulesTest/testJoinProjectTranspose7.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalJoin(condition=[=($1, $2)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(NAME=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalJoin(condition=[=($1, $2)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(NAME=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testJoinProjectTranspose8.json b/tests/RelOptRulesTest/testJoinProjectTranspose8.json deleted file mode 100644 index 731d281..0000000 --- a/tests/RelOptRulesTest/testJoinProjectTranspose8.json +++ /dev/null @@ -1,205 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$2], EXPR$1=[$3])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(NAME=[$1], EXPR$1=[AND(>($0, 10), null)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$2], EXPR$1=[$3])\r\n LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$3], EXPR$1=[AND(>($2, 10), null)])\r\n LogicalJoin(condition=[=($1, $3)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testJoinProjectTransposeWindow.json b/tests/RelOptRulesTest/testJoinProjectTransposeWindow.json deleted file mode 100644 index f88950b..0000000 --- a/tests/RelOptRulesTest/testJoinProjectTransposeWindow.json +++ /dev/null @@ -1,203 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "BIGINT" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BIGINT" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "error": "Not implemented: RANK" - }, - { - "operator": "+", - "operand": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "operator": "CAST", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BIGINT" - }, - { - "column": 2, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "error": "Not implemented: RANK" - }, - { - "operator": "+", - "operand": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0], NAME=[$1], R=[$3], EXPR$1=[$4])\r\n LogicalJoin(condition=[=($2, $3)], joinType=[inner])\r\n LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[CAST($1):BIGINT NOT NULL])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(R=[RANK() OVER (ORDER BY $0)], EXPR$1=[+(1, 1)])\r\n LogicalProject(NAME=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalJoin(condition=[=(CAST($1):BIGINT NOT NULL, $2)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(R=[RANK() OVER (ORDER BY $0)], EXPR$1=[+(1, 1)])\r\n LogicalProject(NAME=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testJoinPushTransitivePredicatesRule2.json b/tests/RelOptRulesTest/testJoinPushTransitivePredicatesRule2.json deleted file mode 100644 index 29df1e3..0000000 --- a/tests/RelOptRulesTest/testJoinPushTransitivePredicatesRule2.json +++ /dev/null @@ -1,1602 +0,0 @@ -{ - "schemas": [ - { - "name": "EMPNULLABLES", - "fields": [ - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - true, - true - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - }, - { - "column": 4, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - }, - { - "column": 3, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - }, - { - "column": 5, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 5, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BOOLEAN" - }, - { - "column": 6, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - }, - { - "column": 4, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - "right": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - }, - { - "column": 3, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - }, - { - "column": 5, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 5, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BOOLEAN" - }, - { - "column": 6, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(SAL=[$0])\r\n LogicalJoin(condition=[AND(=($0, $3), =($1, $4))], joinType=[inner])\r\n LogicalProject(SAL=[$0], $f9=[=($0, 4)])\r\n LogicalFilter(condition=[AND(=($1, 20), >($0, 1000))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n LogicalFilter(condition=[=($1, $0)])\r\n LogicalAggregate(group=[{0, 1, 2}])\r\n LogicalJoin(condition=[OR(=($1, $0), $2)], joinType=[inner])\r\n LogicalProject(SAL=[$0])\r\n LogicalFilter(condition=[AND(=($1, 20), >($0, 1000))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(SAL=[$0], $f9=[=($0, 4)])\r\n LogicalFilter(condition=[AND(=($1, 20), >($0, 1000))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n", - "LogicalProject(SAL=[$0])\r\n LogicalJoin(condition=[AND(=($0, $3), =($1, $4))], joinType=[inner])\r\n LogicalFilter(condition=[>($0, 1000)])\r\n LogicalProject(SAL=[$0], $f9=[=($0, 4)])\r\n LogicalFilter(condition=[AND(=($1, 20), >($0, 1000))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n LogicalFilter(condition=[=($1, $0)])\r\n LogicalAggregate(group=[{0, 1, 2}])\r\n LogicalJoin(condition=[OR(=($1, $0), $2)], joinType=[inner])\r\n LogicalProject(SAL=[$0])\r\n LogicalFilter(condition=[AND(=($1, 20), >($0, 1000))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(SAL=[$0], $f9=[=($0, 4)])\r\n LogicalFilter(condition=[AND(=($1, 20), >($0, 1000))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testLeftEmptyAntiJoin.json b/tests/RelOptRulesTest/testLeftEmptyAntiJoin.json deleted file mode 100644 index 23cc362..0000000 --- a/tests/RelOptRulesTest/testLeftEmptyAntiJoin.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "TINYINT" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "SMALLINT" - } - ], - "source": { - "join": { - "kind": "ANTI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "TINYINT" - }, - { - "column": 8, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - }, - "left": { - "values": { - "schema": [ - "SMALLINT", - "VARCHAR", - "VARCHAR", - "SMALLINT", - "DATE", - "DECIMAL", - "DECIMAL", - "TINYINT" - ], - "content": [] - } - }, - "right": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "SMALLINT" - } - ], - "source": { - "values": { - "schema": [ - "SMALLINT", - "VARCHAR", - "VARCHAR", - "SMALLINT", - "DATE", - "DECIMAL", - "DECIMAL", - "TINYINT" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalJoin(condition=[=($7, $8)], joinType=[anti])\r\n LogicalValues(tuples=[[]])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testLeftEmptyFullJoin.json b/tests/RelOptRulesTest/testLeftEmptyFullJoin.json deleted file mode 100644 index 35cb32f..0000000 --- a/tests/RelOptRulesTest/testLeftEmptyFullJoin.json +++ /dev/null @@ -1,287 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "content": [] - } - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[false])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\r\n LogicalValues(tuples=[[]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testLeftEmptyInnerJoin.json b/tests/RelOptRulesTest/testLeftEmptyInnerJoin.json deleted file mode 100644 index 751afbb..0000000 --- a/tests/RelOptRulesTest/testLeftEmptyInnerJoin.json +++ /dev/null @@ -1,267 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN", - "INTEGER", - "VARCHAR" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[false])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testLeftEmptyLeftJoin.json b/tests/RelOptRulesTest/testLeftEmptyLeftJoin.json deleted file mode 100644 index 52f128b..0000000 --- a/tests/RelOptRulesTest/testLeftEmptyLeftJoin.json +++ /dev/null @@ -1,267 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN", - "INTEGER", - "VARCHAR" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[false])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testLeftEmptyRightJoin.json b/tests/RelOptRulesTest/testLeftEmptyRightJoin.json deleted file mode 100644 index 4798786..0000000 --- a/tests/RelOptRulesTest/testLeftEmptyRightJoin.json +++ /dev/null @@ -1,287 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "content": [] - } - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[false])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\r\n LogicalValues(tuples=[[]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testLeftEmptySemiJoin.json b/tests/RelOptRulesTest/testLeftEmptySemiJoin.json deleted file mode 100644 index 3d94d1f..0000000 --- a/tests/RelOptRulesTest/testLeftEmptySemiJoin.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "TINYINT" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "SMALLINT" - } - ], - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "TINYINT" - }, - { - "column": 8, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - }, - "left": { - "values": { - "schema": [ - "SMALLINT", - "VARCHAR", - "VARCHAR", - "SMALLINT", - "DATE", - "DECIMAL", - "DECIMAL", - "TINYINT" - ], - "content": [] - } - }, - "right": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "SMALLINT" - } - ], - "source": { - "values": { - "schema": [ - "SMALLINT", - "VARCHAR", - "VARCHAR", - "SMALLINT", - "DATE", - "DECIMAL", - "DECIMAL", - "TINYINT" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalJoin(condition=[=($7, $8)], joinType=[semi])\r\n LogicalValues(tuples=[[]])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testLeftOuterJoinSimplificationToInner.json b/tests/RelOptRulesTest/testLeftOuterJoinSimplificationToInner.json deleted file mode 100644 index 71a846b..0000000 --- a/tests/RelOptRulesTest/testLeftOuterJoinSimplificationToInner.json +++ /dev/null @@ -1,166 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalFilter(condition=[>($1, 100)])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalProject(DUMMY=[0])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalFilter(condition=[>($0, 100)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testMaxReuseDistinctAttrWithMixedOptionality.json b/tests/RelOptRulesTest/testMaxReuseDistinctAttrWithMixedOptionality.json deleted file mode 100644 index 9c80838..0000000 --- a/tests/RelOptRulesTest/testMaxReuseDistinctAttrWithMixedOptionality.json +++ /dev/null @@ -1,251 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[MAX($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT()], EXPR$2=[MAX($0)])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testMergeFilter.json b/tests/RelOptRulesTest/testMergeFilter.json deleted file mode 100644 index 54866e6..0000000 --- a/tests/RelOptRulesTest/testMergeFilter.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(NAME=[$1])\r\n LogicalFilter(condition=[=($0, 10)])\r\n LogicalProject(DEPTNO=[$0], NAME=[$1])\r\n LogicalFilter(condition=[=($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(NAME=[$1])\r\n LogicalFilter(condition=[=($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testMergeIntersect.json b/tests/RelOptRulesTest/testMergeIntersect.json deleted file mode 100644 index cf252d3..0000000 --- a/tests/RelOptRulesTest/testMergeIntersect.json +++ /dev/null @@ -1,448 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "intersect": [ - { - "intersect": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - }, - { - "intersect": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - ], - "help": [ - "LogicalIntersect(all=[false])\r\n LogicalIntersect(all=[false])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 30)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalIntersect(all=[false])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 30)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testMergeJoinFilter.json b/tests/RelOptRulesTest/testMergeJoinFilter.json deleted file mode 100644 index 0122d52..0000000 --- a/tests/RelOptRulesTest/testMergeJoinFilter.json +++ /dev/null @@ -1,182 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalFilter(condition=[=($0, 10)])\r\n LogicalProject(DEPTNO=[$2], ENAME=[$0])\r\n LogicalJoin(condition=[AND(=($1, $2), =($2, 10))], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(DEPTNO=[$2], ENAME=[$0])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[=($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testMergeMinus.json b/tests/RelOptRulesTest/testMergeMinus.json deleted file mode 100644 index 1722b51..0000000 --- a/tests/RelOptRulesTest/testMergeMinus.json +++ /dev/null @@ -1,454 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "except": [ - { - "distinct": { - "except": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "except": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalMinus(all=[false])\r\n LogicalMinus(all=[false])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 30)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalMinus(all=[false])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 30)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testMergeUnionAll.json b/tests/RelOptRulesTest/testMergeUnionAll.json deleted file mode 100644 index 7c628ca..0000000 --- a/tests/RelOptRulesTest/testMergeUnionAll.json +++ /dev/null @@ -1,448 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "union": [ - { - "union": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - }, - { - "union": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - ], - "help": [ - "LogicalUnion(all=[true])\r\n LogicalUnion(all=[true])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 30)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalUnion(all=[true])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 30)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testMergeUnionDistinct.json b/tests/RelOptRulesTest/testMergeUnionDistinct.json deleted file mode 100644 index bac3d23..0000000 --- a/tests/RelOptRulesTest/testMergeUnionDistinct.json +++ /dev/null @@ -1,454 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "union": [ - { - "distinct": { - "union": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "union": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalUnion(all=[false])\r\n LogicalUnion(all=[false])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 30)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalUnion(all=[false])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 30)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testMergeUnionMixed2.json b/tests/RelOptRulesTest/testMergeUnionMixed2.json deleted file mode 100644 index 1011156..0000000 --- a/tests/RelOptRulesTest/testMergeUnionMixed2.json +++ /dev/null @@ -1,452 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "union": [ - { - "union": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "union": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalUnion(all=[false])\r\n LogicalUnion(all=[true])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 30)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalUnion(all=[false])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($7, 30)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testMinReuseDistinctAttrWithMixedOptionality.json b/tests/RelOptRulesTest/testMinReuseDistinctAttrWithMixedOptionality.json deleted file mode 100644 index 70d18f9..0000000 --- a/tests/RelOptRulesTest/testMinReuseDistinctAttrWithMixedOptionality.json +++ /dev/null @@ -1,251 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[MIN($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT()], EXPR$2=[MIN($0)])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testMinusMergeRule.json b/tests/RelOptRulesTest/testMinusMergeRule.json deleted file mode 100644 index a807521..0000000 --- a/tests/RelOptRulesTest/testMinusMergeRule.json +++ /dev/null @@ -1,439 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "except": [ - { - "except": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "except": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "except": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - ] - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - }, - { - "except": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "except": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - ], - "help": [ - "LogicalMinus(all=[true])\r\n LogicalMinus(all=[true])\r\n LogicalProject(NAME=[$0], DEPTNO=[$1])\r\n LogicalMinus(all=[true])\r\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0], EXPR$2=[1])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(NAME=[$0], DEPTNO=[$1])\r\n LogicalMinus(all=[true])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0], EXPR$2=[1])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalMinus(all=[true])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalMinus(all=[true])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testMultipleDistinctWithGrouping.json b/tests/RelOptRulesTest/testMultipleDistinctWithGrouping.json deleted file mode 100644 index b647850..0000000 --- a/tests/RelOptRulesTest/testMultipleDistinctWithGrouping.json +++ /dev/null @@ -1,635 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL", - "COMM" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "AVG", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "IS NOT DISTINCT FROM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "IS NOT DISTINCT FROM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "AVG", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[AVG(DISTINCT $1)], EXPR$3=[SUM(DISTINCT $0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(SAL=[$0], EXPR$1=[$1], EXPR$2=[$3], EXPR$3=[$5])\r\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner])\r\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner])\r\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], EXPR$2=[AVG($1)])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], EXPR$3=[SUM($0)])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(SAL=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testNoOversimplificationBelowIsNull.json b/tests/RelOptRulesTest/testNoOversimplificationBelowIsNull.json deleted file mode 100644 index e86bc12..0000000 --- a/tests/RelOptRulesTest/testNoOversimplificationBelowIsNull.json +++ /dev/null @@ -1,308 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NULL", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NULL", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "NULL", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[IS NULL(OR(AND(=($0, 1), =($3, 1)), AND(=($0, null), =($3, 1))))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[IS NULL(OR(AND(=($0, 1), =($3, 1)), AND(null, =($3, 1))))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testOrAlwaysTrue.json b/tests/RelOptRulesTest/testOrAlwaysTrue.json deleted file mode 100644 index 9735b84..0000000 --- a/tests/RelOptRulesTest/testOrAlwaysTrue.json +++ /dev/null @@ -1,244 +0,0 @@ -{ - "schemas": [ - { - "name": "EMPNULLABLES", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - true, - true, - true, - true, - true, - true, - true, - true - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalFilter(condition=[OR(IS NULL($5), IS NOT NULL($5))])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\r\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\r\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testOrAlwaysTrue2.json b/tests/RelOptRulesTest/testOrAlwaysTrue2.json deleted file mode 100644 index 685719c..0000000 --- a/tests/RelOptRulesTest/testOrAlwaysTrue2.json +++ /dev/null @@ -1,244 +0,0 @@ -{ - "schemas": [ - { - "name": "EMPNULLABLES", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - true, - true, - true, - true, - true, - true, - true, - true - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalFilter(condition=[OR(IS NOT NULL($5), IS NULL($5))])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\r\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\r\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testOversimplifiedCaseStatement.json b/tests/RelOptRulesTest/testOversimplifiedCaseStatement.json deleted file mode 100644 index c480a9e..0000000 --- a/tests/RelOptRulesTest/testOversimplifiedCaseStatement.json +++ /dev/null @@ -1,294 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "/", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "operator": "/", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[AND(>($3, 0), >(CASE(>($3, 0), /($7, $3), null:INTEGER), 1))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[AND(>($3, 0), CASE(>($3, 0), >(/($7, $3), 1), false))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testProjectAggregateMerge.json b/tests/RelOptRulesTest/testProjectAggregateMerge.json deleted file mode 100644 index e13b687..0000000 --- a/tests/RelOptRulesTest/testProjectAggregateMerge.json +++ /dev/null @@ -1,306 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[+($1, $2)])\r\n LogicalAggregate(group=[{0, 1}], SS=[SUM($2)])\r\n LogicalProject(JOB=[$0], DEPTNO=[$2], SAL=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject($f0=[+($1, $2)])\r\n LogicalAggregate(group=[{0, 1}], SS=[SUM($2)])\r\n LogicalProject(JOB=[$0], DEPTNO=[$2], SAL=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testProjectAggregateMergeSum0.json b/tests/RelOptRulesTest/testProjectAggregateMergeSum0.json deleted file mode 100644 index 9b919d9..0000000 --- a/tests/RelOptRulesTest/testProjectAggregateMergeSum0.json +++ /dev/null @@ -1,149 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalProject(SS0=[CASE(IS NOT NULL($0), CAST($0):INTEGER NOT NULL, 0)])\r\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], agg#0=[$SUM0($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testProjectAggregateMergeSum0AndSum.json b/tests/RelOptRulesTest/testProjectAggregateMergeSum0AndSum.json deleted file mode 100644 index 002a784..0000000 --- a/tests/RelOptRulesTest/testProjectAggregateMergeSum0AndSum.json +++ /dev/null @@ -1,201 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "*", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "*", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "$SUM0", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[*($0, 2)], SS0=[CASE(IS NOT NULL($0), CAST($0):INTEGER NOT NULL, 0)])\r\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject($f0=[*($0, 2)], $f1=[$1])\r\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)], agg#1=[$SUM0($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testProjectCorrelateTransposeRuleLeftCorrelate.json b/tests/RelOptRulesTest/testProjectCorrelateTransposeRuleLeftCorrelate.json deleted file mode 100644 index 98de5bf..0000000 --- a/tests/RelOptRulesTest/testProjectCorrelateTransposeRuleLeftCorrelate.json +++ /dev/null @@ -1,364 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 9, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "correlate": [ - { - "scan": 0 - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 9, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BOOLEAN" - } - ], - "source": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[IS NOT NULL($9)])\r\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\r\n LogicalProject($f0=[true])\r\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[IS NOT NULL($1)])\r\n LogicalProject(EMPNO=[$0], $f0=[$2])\r\n LogicalCorrelate(correlation=[$cor2], joinType=[left], requiredColumns=[{1}])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\r\n LogicalProject($f0=[true])\r\n LogicalFilter(condition=[=($cor2.DEPTNO, $0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testProjectJoinRemove1.json b/tests/RelOptRulesTest/testProjectJoinRemove1.json deleted file mode 100644 index d257ef9..0000000 --- a/tests/RelOptRulesTest/testProjectJoinRemove1.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0], DEPTNO0=[$2])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testProjectJoinRemove10.json b/tests/RelOptRulesTest/testProjectJoinRemove10.json deleted file mode 100644 index 2c581cd..0000000 --- a/tests/RelOptRulesTest/testProjectJoinRemove10.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "scan": 0 - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0], SLACKER=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testProjectJoinRemove4.json b/tests/RelOptRulesTest/testProjectJoinRemove4.json deleted file mode 100644 index 7ee6590..0000000 --- a/tests/RelOptRulesTest/testProjectJoinRemove4.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "scan": 0 - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testProjectJoinRemove7.json b/tests/RelOptRulesTest/testProjectJoinRemove7.json deleted file mode 100644 index ea56593..0000000 --- a/tests/RelOptRulesTest/testProjectJoinRemove7.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "scan": 1 - } - ], - "help": [ - "LogicalProject(DEPTNO=[$1])\r\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testProjectJoinTransposeItem.json b/tests/RelOptRulesTest/testProjectJoinTransposeItem.json deleted file mode 100644 index 2897bf6..0000000 --- a/tests/RelOptRulesTest/testProjectJoinTransposeItem.json +++ /dev/null @@ -1,274 +0,0 @@ -{ - "schemas": [ - { - "name": "CUSTOMER", - "fields": [ - "C_NATIONKEY" - ], - "types": [ - "ANY" - ], - "nullable": [ - true - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "ITEM", - "operand": [ - { - "column": 0, - "type": "ANY" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "ANY" - }, - { - "operator": "ITEM", - "operand": [ - { - "column": 2, - "type": "ANY" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "ANY" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "ANY" - }, - { - "column": 3, - "type": "ANY" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "ANY" - }, - { - "operator": "ITEM", - "operand": [ - { - "column": 0, - "type": "ANY" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "ANY" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "ANY" - }, - { - "operator": "ITEM", - "operand": [ - { - "column": 0, - "type": "ANY" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "ANY" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "ANY" - }, - { - "column": 3, - "type": "ANY" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "ANY" - }, - { - "column": 2, - "type": "ANY" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "ANY" - }, - { - "operator": "ITEM", - "operand": [ - { - "column": 0, - "type": "ANY" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "ANY" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "ANY" - }, - { - "operator": "ITEM", - "operand": [ - { - "column": 0, - "type": "ANY" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "ANY" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "ANY" - }, - { - "operator": "ITEM", - "operand": [ - { - "column": 0, - "type": "ANY" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "ANY" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "ANY" - }, - { - "operator": "ITEM", - "operand": [ - { - "column": 0, - "type": "ANY" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "ANY" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[ITEM($0, 0)], EXPR$1=[ITEM($2, 0)])\r\n LogicalJoin(condition=[=($1, $3)], joinType=[left])\r\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\r\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\r\n", - "LogicalProject(EXPR$0=[$1], EXPR$1=[$3])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\r\n LogicalProject($f1=[$1], EXPR$0=[ITEM($0, 0)])\r\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\r\n LogicalProject($f1=[$1], EXPR$0=[ITEM($0, 0)])\r\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testProjectSetOpTranspose.json b/tests/RelOptRulesTest/testProjectSetOpTranspose.json deleted file mode 100644 index 6934315..0000000 --- a/tests/RelOptRulesTest/testProjectSetOpTranspose.json +++ /dev/null @@ -1,134 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "error": "Not implemented: SUM" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "error": "Not implemented: SUM" - } - ], - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - } - ], - "help": [ - "LogicalProject(JOB=[$0], EXPR$1=[SUM(+($1, 100)) OVER (PARTITION BY $2)])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(JOB=[$0], EXPR$1=[SUM($2) OVER (PARTITION BY $1)])\r\n LogicalUnion(all=[true])\r\n LogicalProject(JOB=[$0], DEPTNO=[$2], EXPR$0=[+($1, 100)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(JOB=[$0], DEPTNO=[$2], EXPR$0=[+($1, 100)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullAggregateThroughUnion.json b/tests/RelOptRulesTest/testPullAggregateThroughUnion.json deleted file mode 100644 index 52b80a3..0000000 --- a/tests/RelOptRulesTest/testPullAggregateThroughUnion.json +++ /dev/null @@ -1,625 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 1}])\r\n LogicalUnion(all=[true])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullAggregateThroughUnion2.json b/tests/RelOptRulesTest/testPullAggregateThroughUnion2.json deleted file mode 100644 index 52b80a3..0000000 --- a/tests/RelOptRulesTest/testPullAggregateThroughUnion2.json +++ /dev/null @@ -1,625 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 1}])\r\n LogicalUnion(all=[true])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullAggregateThroughUnionAndAddProjects.json b/tests/RelOptRulesTest/testPullAggregateThroughUnionAndAddProjects.json deleted file mode 100644 index 37b3938..0000000 --- a/tests/RelOptRulesTest/testPullAggregateThroughUnionAndAddProjects.json +++ /dev/null @@ -1,457 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 1}])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullAggregateThroughUnionWithAlias.json b/tests/RelOptRulesTest/testPullAggregateThroughUnionWithAlias.json deleted file mode 100644 index 5799e8f..0000000 --- a/tests/RelOptRulesTest/testPullAggregateThroughUnionWithAlias.json +++ /dev/null @@ -1,589 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "scan": 0 - } - ] - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "scan": 0 - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 1}])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullConstantIntoFilter.json b/tests/RelOptRulesTest/testPullConstantIntoFilter.json deleted file mode 100644 index 294b801..0000000 --- a/tests/RelOptRulesTest/testPullConstantIntoFilter.json +++ /dev/null @@ -1,312 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "operator": "+", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "operator": "15", - "operand": [], - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[>(+($7, 5), $0)])\r\n LogicalFilter(condition=[=($7, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[>(15, $0)])\r\n LogicalFilter(condition=[=($7, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullConstantIntoJoin.json b/tests/RelOptRulesTest/testPullConstantIntoJoin.json deleted file mode 100644 index 32356b6..0000000 --- a/tests/RelOptRulesTest/testPullConstantIntoJoin.json +++ /dev/null @@ -1,355 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalJoin(condition=[true], joinType=[left])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[=($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullConstantIntoJoin2.json b/tests/RelOptRulesTest/testPullConstantIntoJoin2.json deleted file mode 100644 index 5ec753d..0000000 --- a/tests/RelOptRulesTest/testPullConstantIntoJoin2.json +++ /dev/null @@ -1,451 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 10, - "type": "INTEGER" - }, - { - "column": 11, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 12, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "operator": "+", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "TIMESTAMP" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "BOOLEAN" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "column": 9, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 8, - "type": "INTEGER" - }, - { - "operator": "15", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "operator": "+", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$10], NAME=[$11])\r\n LogicalJoin(condition=[AND(=($0, $10), =($9, $12))], joinType=[inner])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\r\n LogicalFilter(condition=[=($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[10], ENAME=[$0], JOB=[$1], MGR=[$2], HIREDATE=[$3], SAL=[$4], COMM=[$5], DEPTNO=[$6], SLACKER=[$7], DEPTNO0=[10], NAME=[$9])\r\n LogicalJoin(condition=[=($8, 15)], joinType=[inner])\r\n LogicalProject(ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, 10)])\r\n LogicalFilter(condition=[=($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(NAME=[$1])\r\n LogicalFilter(condition=[=($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullConstantIntoProject.json b/tests/RelOptRulesTest/testPullConstantIntoProject.json deleted file mode 100644 index 8bc9af0..0000000 --- a/tests/RelOptRulesTest/testPullConstantIntoProject.json +++ /dev/null @@ -1,145 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$1], EXPR$1=[+($1, 1)], EXPR$2=[+($0, $1)])\r\n LogicalFilter(condition=[=($1, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[10], EXPR$1=[11], EXPR$2=[+($0, 10)])\r\n LogicalFilter(condition=[=($1, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullConstantIntoProjectWithIsNotDistinctFrom.json b/tests/RelOptRulesTest/testPullConstantIntoProjectWithIsNotDistinctFrom.json deleted file mode 100644 index 0d4b8fd..0000000 --- a/tests/RelOptRulesTest/testPullConstantIntoProjectWithIsNotDistinctFrom.json +++ /dev/null @@ -1,223 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$1], EXPR$1=[+($1, 1)], EXPR$2=[+($0, $1)])\r\n LogicalFilter(condition=[OR(AND(IS NULL($1), IS NULL(10)), IS TRUE(=($1, 10)))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[10], EXPR$1=[11], EXPR$2=[+($0, 10)])\r\n LogicalFilter(condition=[OR(AND(IS NULL($1), IS NULL(10)), IS TRUE(=($1, 10)))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json b/tests/RelOptRulesTest/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json deleted file mode 100644 index 0e7e18d..0000000 --- a/tests/RelOptRulesTest/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "MGR", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - true, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalFilter(condition=[OR(AND(IS NULL($0), IS NULL(null:INTEGER)), IS TRUE(=($0, null)))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(MGR=[null:INTEGER], DEPTNO=[$1])\r\n LogicalFilter(condition=[OR(AND(IS NULL($0), IS NULL(null:INTEGER)), IS TRUE(=($0, null)))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullConstantThroughAggregateAllConst.json b/tests/RelOptRulesTest/testPullConstantThroughAggregateAllConst.json deleted file mode 100644 index ce8772c..0000000 --- a/tests/RelOptRulesTest/testPullConstantThroughAggregateAllConst.json +++ /dev/null @@ -1,368 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\r\n LogicalProject(EXPR$0=[4], EXPR$1=[+(2, 3)], FIVE=[5])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[$0], EXPR$1=[+(2, 3)], EXPR$2=[$1])\r\n LogicalAggregate(group=[{0}], EXPR$2=[MAX($1)])\r\n LogicalProject(EXPR$0=[4], FIVE=[5])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullConstantThroughAggregateAllLiterals.json b/tests/RelOptRulesTest/testPullConstantThroughAggregateAllLiterals.json deleted file mode 100644 index 1e533fa..0000000 --- a/tests/RelOptRulesTest/testPullConstantThroughAggregateAllLiterals.json +++ /dev/null @@ -1,368 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\r\n LogicalProject(EXPR$0=[4], EXPR$1=[+(2, 3)], $f2=[5])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[$0], EXPR$1=[+(2, 3)], EXPR$2=[$1])\r\n LogicalAggregate(group=[{0}], EXPR$2=[MAX($1)])\r\n LogicalProject(EXPR$0=[4], $f2=[5])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullConstantThroughAggregateConstGroupBy.json b/tests/RelOptRulesTest/testPullConstantThroughAggregateConstGroupBy.json deleted file mode 100644 index 82e490d..0000000 --- a/tests/RelOptRulesTest/testPullConstantThroughAggregateConstGroupBy.json +++ /dev/null @@ -1,292 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "MGR" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - true - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\r\n LogicalProject(EXPR$0=[4], EXPR$1=[+(2, 3)], MGR=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[$0], EXPR$1=[+(2, 3)], EXPR$2=[$1])\r\n LogicalAggregate(group=[{0}], EXPR$2=[MAX($1)])\r\n LogicalProject(EXPR$0=[4], MGR=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullConstantThroughAggregatePermuted.json b/tests/RelOptRulesTest/testPullConstantThroughAggregatePermuted.json deleted file mode 100644 index c9c2abb..0000000 --- a/tests/RelOptRulesTest/testPullConstantThroughAggregatePermuted.json +++ /dev/null @@ -1,413 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "MGR", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - true, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "42", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 8, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "42", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "42", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "42", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0], EXPR$1=[$4])\r\n LogicalAggregate(group=[{0, 1, 2, 3}], EXPR$1=[MAX($4)])\r\n LogicalProject(DEPTNO=[$1], FOUR=[4], TWO_PLUS_THREE=[+(2, 3)], DEPTNO42=[+($1, 42)], MGR=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], EXPR$1=[$2])\r\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\r\n LogicalProject(DEPTNO=[$1], DEPTNO42=[+($1, 42)], MGR=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullConstantThroughAggregatePermutedConstFirst.json b/tests/RelOptRulesTest/testPullConstantThroughAggregatePermutedConstFirst.json deleted file mode 100644 index 821eb7c..0000000 --- a/tests/RelOptRulesTest/testPullConstantThroughAggregatePermutedConstFirst.json +++ /dev/null @@ -1,253 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "MGR", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - true, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$1], EXPR$1=[$2])\r\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\r\n LogicalProject(FOUR=[4], DEPTNO=[$1], MGR=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\r\n LogicalProject(DEPTNO=[$1], MGR=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullConstantThroughAggregatePermutedConstGroupBy.json b/tests/RelOptRulesTest/testPullConstantThroughAggregatePermutedConstGroupBy.json deleted file mode 100644 index e3a971a..0000000 --- a/tests/RelOptRulesTest/testPullConstantThroughAggregatePermutedConstGroupBy.json +++ /dev/null @@ -1,275 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "MGR", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - true, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "operator": "42", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "24", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "operator": "42", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "24", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$1], EXPR$1=[$2])\r\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\r\n LogicalProject($f0=[+(42, 24)], DEPTNO=[$1], MGR=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\r\n LogicalProject(DEPTNO=[$1], MGR=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullConstantThroughAggregateSimpleNonNullable.json b/tests/RelOptRulesTest/testPullConstantThroughAggregateSimpleNonNullable.json deleted file mode 100644 index 094cc56..0000000 --- a/tests/RelOptRulesTest/testPullConstantThroughAggregateSimpleNonNullable.json +++ /dev/null @@ -1,253 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0], EXPR$1=[$2])\r\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\r\n LogicalProject(DEPTNO=[$1], FOUR=[4], ENAME=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\r\n LogicalProject(DEPTNO=[$1], ENAME=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullConstantThroughConstLast.json b/tests/RelOptRulesTest/testPullConstantThroughConstLast.json deleted file mode 100644 index dfe49f4..0000000 --- a/tests/RelOptRulesTest/testPullConstantThroughConstLast.json +++ /dev/null @@ -1,253 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "MGR", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - true, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0], EXPR$1=[$2])\r\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\r\n LogicalProject(DEPTNO=[$1], FOUR=[4], MGR=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\r\n LogicalProject(DEPTNO=[$1], MGR=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullConstantThroughUnion.json b/tests/RelOptRulesTest/testPullConstantThroughUnion.json deleted file mode 100644 index 05fdf35..0000000 --- a/tests/RelOptRulesTest/testPullConstantThroughUnion.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "union": [ - { - "project": { - "target": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - ] - }, - { - "project": { - "target": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - } - ], - "help": [ - "LogicalUnion(all=[true])\r\n LogicalProject(EXPR$0=[2], DEPTNO=[$1], JOB=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EXPR$0=[2], DEPTNO=[$1], JOB=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[2], DEPTNO=[$0], JOB=[$1])\r\n LogicalUnion(all=[true])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullConstantThroughUnion3.json b/tests/RelOptRulesTest/testPullConstantThroughUnion3.json deleted file mode 100644 index 6a4dea5..0000000 --- a/tests/RelOptRulesTest/testPullConstantThroughUnion3.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "union": [ - { - "project": { - "target": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - ] - }, - { - "project": { - "target": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "project": { - "target": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - ], - "help": [ - "LogicalUnion(all=[true])\r\n LogicalProject(EXPR$0=[2], EXPR$1=[3])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EXPR$0=[2], EXPR$1=[3])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[2], EXPR$1=[3])\r\n LogicalUnion(all=[true])\r\n LogicalProject(EXPR$0=[2])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EXPR$0=[2])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullFilterThroughAggregate.json b/tests/RelOptRulesTest/testPullFilterThroughAggregate.json deleted file mode 100644 index 2c39cc9..0000000 --- a/tests/RelOptRulesTest/testPullFilterThroughAggregate.json +++ /dev/null @@ -1,261 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "5000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "5000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "5000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1, 2}])\r\n LogicalFilter(condition=[>($1, 5000)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalFilter(condition=[>($1, 5000)])\r\n LogicalAggregate(group=[{0, 1, 2}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullFilterThroughAggregateGroupingSets.json b/tests/RelOptRulesTest/testPullFilterThroughAggregateGroupingSets.json deleted file mode 100644 index 92e03b1..0000000 --- a/tests/RelOptRulesTest/testPullFilterThroughAggregateGroupingSets.json +++ /dev/null @@ -1,448 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "5000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "5000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "5000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "5000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 8, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1, 2}, {0, 1}, {0}, {}]])\r\n LogicalFilter(condition=[>($1, 5000)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1, 2}, {0, 1}, {0}, {}]])\r\n LogicalFilter(condition=[>($1, 5000)])\r\n LogicalAggregate(group=[{0, 1, 2}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPullNull.json b/tests/RelOptRulesTest/testPullNull.json deleted file mode 100644 index 07f48e2..0000000 --- a/tests/RelOptRulesTest/testPullNull.json +++ /dev/null @@ -1,260 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[AND(=($7, 7), =($0, 10), IS NULL($3), =($0, 10))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[10], ENAME=[$1], JOB=[$2], MGR=[null:INTEGER], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[7], SLACKER=[$8])\r\n LogicalFilter(condition=[AND(=($7, 7), =($0, 10), IS NULL($3))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAboveFiltersIntoInnerJoinCondition.json b/tests/RelOptRulesTest/testPushAboveFiltersIntoInnerJoinCondition.json deleted file mode 100644 index bb7faa0..0000000 --- a/tests/RelOptRulesTest/testPushAboveFiltersIntoInnerJoinCondition.json +++ /dev/null @@ -1,281 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "TIMESTAMP" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "TIMESTAMP" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\r\n LogicalFilter(condition=[>($0, $5)])\r\n LogicalJoin(condition=[AND(=($0, $9), >($0, $5))], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\r\n LogicalJoin(condition=[AND(=($0, $9), >($0, $5))], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateFunctionsThroughJoin.json b/tests/RelOptRulesTest/testPushAggregateFunctionsThroughJoin.json deleted file mode 100644 index fbad485..0000000 --- a/tests/RelOptRulesTest/testPushAggregateFunctionsThroughJoin.json +++ /dev/null @@ -1,593 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "MGR", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - true, - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "NAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 6, - "type": "BIGINT" - }, - { - "column": 7, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "BIGINT" - }, - { - "column": 6, - "type": "BIGINT" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "column": 8, - "type": "BIGINT" - } - ], - "type": "BIGINT" - }, - { - "operator": "*", - "operand": [ - { - "column": 6, - "type": "BIGINT" - }, - { - "column": 8, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 7, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(JOB=[$0], MIN_SAL=[$2], MIN_DEPTNO=[$3], SUM_SAL_PLUS=[+($4, 1)], MAX_SAL=[$5], SUM_SAL_2=[$4], COUNT_SAL=[$6], COUNT_MGR=[$7])\r\n LogicalAggregate(group=[{0, 4}], MIN_SAL=[MIN($2)], MIN_DEPTNO=[MIN($3)], SUM_SAL_2=[SUM($2)], MAX_SAL=[MAX($2)], COUNT_SAL=[COUNT()], COUNT_MGR=[COUNT($1)])\r\n LogicalJoin(condition=[=($0, $4)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(JOB=[$0], MIN_SAL=[$1], MIN_DEPTNO=[$2], SUM_SAL_PLUS=[+($3, 1)], MAX_SAL=[$4], SUM_SAL_2=[$3], COUNT_SAL=[$5], COUNT_MGR=[$6])\r\n LogicalProject(JOB=[$0], MIN_SAL=[$1], MIN_DEPTNO=[$2], $f9=[CAST(*($3, $8)):INTEGER NOT NULL], MAX_SAL=[$4], $f10=[*($5, $8)], $f11=[*($6, $8)])\r\n LogicalJoin(condition=[=($0, $7)], joinType=[inner])\r\n LogicalAggregate(group=[{0}], MIN_SAL=[MIN($2)], MIN_DEPTNO=[MIN($3)], SUM_SAL_2=[SUM($2)], MAX_SAL=[MAX($2)], COUNT_SAL=[COUNT()], COUNT_MGR=[COUNT($1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateSumNoGroup.json b/tests/RelOptRulesTest/testPushAggregateSumNoGroup.json deleted file mode 100644 index 492b4c8..0000000 --- a/tests/RelOptRulesTest/testPushAggregateSumNoGroup.json +++ /dev/null @@ -1,473 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "NAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "operator": "*", - "operand": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 0, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "*", - "operand": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[$SUM0($0)])\r\n LogicalProject($f4=[*($1, $3)])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateSumThroughJoin.json b/tests/RelOptRulesTest/testPushAggregateSumThroughJoin.json deleted file mode 100644 index cca0cec..0000000 --- a/tests/RelOptRulesTest/testPushAggregateSumThroughJoin.json +++ /dev/null @@ -1,488 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB", - "SAL" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "NAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(JOB=[$0], EXPR$1=[$2])\r\n LogicalAggregate(group=[{0, 2}], EXPR$1=[SUM($1)])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalProject(JOB=[$1], SAL=[$2])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(JOB=[$0], $f4=[CAST(*($1, $3)):INTEGER NOT NULL])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalProject(JOB=[$1], SAL=[$2])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateSumThroughJoinAfterAggregateReduce.json b/tests/RelOptRulesTest/testPushAggregateSumThroughJoinAfterAggregateReduce.json deleted file mode 100644 index e61561d..0000000 --- a/tests/RelOptRulesTest/testPushAggregateSumThroughJoinAfterAggregateReduce.json +++ /dev/null @@ -1,794 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB", - "SAL" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "NAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "operator": "CAST", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "$SUM0", - "operand": [ - { - "column": 1, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CAST", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[SUM($1)])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalProject(JOB=[$1], SAL=[$2])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EXPR$0=[CASE(=($1, 0), null:INTEGER, $0)])\r\n LogicalAggregate(group=[{}], EXPR$0=[$SUM0($0)], agg#1=[$SUM0($1)])\r\n LogicalProject($f5=[CAST(*($1, $4)):INTEGER NOT NULL], $f6=[*($2, $4)])\r\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\r\n LogicalAggregate(group=[{0}], EXPR$0=[$SUM0($1)], agg#1=[COUNT()])\r\n LogicalProject(JOB=[$1], SAL=[$2])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateSumWithoutGroupKeyThroughJoin.json b/tests/RelOptRulesTest/testPushAggregateSumWithoutGroupKeyThroughJoin.json deleted file mode 100644 index dd78fc5..0000000 --- a/tests/RelOptRulesTest/testPushAggregateSumWithoutGroupKeyThroughJoin.json +++ /dev/null @@ -1,704 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB", - "SAL" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "NAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "operator": "CAST", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CAST", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[SUM($1)])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalProject(JOB=[$1], SAL=[$2])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\r\n LogicalProject($f4=[CAST(*($1, $3)):INTEGER])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalAggregate(group=[{0}], EXPR$0=[SUM($1)])\r\n LogicalProject(JOB=[$1], SAL=[$2])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughJoin1.json b/tests/RelOptRulesTest/testPushAggregateThroughJoin1.json deleted file mode 100644 index d58e067..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughJoin1.json +++ /dev/null @@ -1,391 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB" - ], - "types": [ - "VARCHAR", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "NAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - }, - { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalProject(JOB=[$1])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(JOB=[$1])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughJoin2.json b/tests/RelOptRulesTest/testPushAggregateThroughJoin2.json deleted file mode 100644 index 7c103df..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughJoin2.json +++ /dev/null @@ -1,1036 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "DEPTNO" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 2}])\r\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[inner])\r\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\r\n LogicalFilter(condition=[=($1, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{0, 2}])\r\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[inner])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\r\n LogicalFilter(condition=[=($1, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughJoin4.json b/tests/RelOptRulesTest/testPushAggregateThroughJoin4.json deleted file mode 100644 index 227d983..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughJoin4.json +++ /dev/null @@ -1,220 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(DEPTNO=[$0])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughJoin5.json b/tests/RelOptRulesTest/testPushAggregateThroughJoin5.json deleted file mode 100644 index e345241..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughJoin5.json +++ /dev/null @@ -1,228 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - }, - { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - "right": { - "scan": 1 - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughJoin6.json b/tests/RelOptRulesTest/testPushAggregateThroughJoin6.json deleted file mode 100644 index 86cf80f..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughJoin6.json +++ /dev/null @@ -1,556 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "operator": "CAST", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CAST", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[SUM($1)])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\r\n LogicalProject($f3=[CAST(*($1, $2)):INTEGER])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughJoin7.json b/tests/RelOptRulesTest/testPushAggregateThroughJoin7.json deleted file mode 100644 index e04be70..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughJoin7.json +++ /dev/null @@ -1,488 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "ANY_VALUE", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "ANY_VALUE", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[ANY_VALUE($1)])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[ANY_VALUE($1)])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughJoin8.json b/tests/RelOptRulesTest/testPushAggregateThroughJoin8.json deleted file mode 100644 index efd4a6c..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughJoin8.json +++ /dev/null @@ -1,488 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SINGLE_VALUE", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SINGLE_VALUE", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[SINGLE_VALUE($1)])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[SINGLE_VALUE($1)])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughJoinDistinct.json b/tests/RelOptRulesTest/testPushAggregateThroughJoinDistinct.json deleted file mode 100644 index 5323cbb..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughJoinDistinct.json +++ /dev/null @@ -1,411 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "SAL" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "NAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BIGINT" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{2}], SUM_SAL=[SUM($1)], C=[COUNT()])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(NAME=[$3], SUM_SAL=[$1], C=[$2])\r\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\r\n LogicalAggregate(group=[{0}], SUM_SAL=[SUM($1)], C=[COUNT()])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughJoinOnEmptyLogicalValues.json b/tests/RelOptRulesTest/testPushAggregateThroughJoinOnEmptyLogicalValues.json deleted file mode 100644 index 25c604d..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughJoinOnEmptyLogicalValues.json +++ /dev/null @@ -1,527 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "content": [] - } - } - } - }, - "right": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "content": [] - } - } - } - }, - "right": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "content": [] - } - } - } - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 0, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "content": [] - } - } - } - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], VOLUME=[COUNT()], C1_SUM_SAL=[SUM($0)])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\r\n LogicalProject(SAL=[$5], ENAME=[$1])\r\n LogicalValues(tuples=[[]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], VOLUME=[$SUM0($0)], C1_SUM_SAL=[SUM($1)])\r\n LogicalProject(VOLUME=[$3], $f4=[CAST(*($1, $3)):INTEGER])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalProject(ENAME=[$1], SAL=[$0])\r\n LogicalProject(SAL=[$5], ENAME=[$1])\r\n LogicalValues(tuples=[[]])\r\n LogicalAggregate(group=[{0}], VOLUME=[COUNT()])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughJoinWithUniqueInput.json b/tests/RelOptRulesTest/testPushAggregateThroughJoinWithUniqueInput.json deleted file mode 100644 index caff6df..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughJoinWithUniqueInput.json +++ /dev/null @@ -1,1319 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - true, - false, - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "TIMESTAMP" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "TIMESTAMP" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 3, - "type": "TIMESTAMP" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "TIMESTAMP" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 8, - "type": "TIMESTAMP" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "TIMESTAMP" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 8, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "TIMESTAMP" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 6, - "type": "TIMESTAMP" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "TIMESTAMP" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 8, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "TIMESTAMP" - }, - { - "column": 8, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "TIMESTAMP" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 6, - "type": "TIMESTAMP" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 8, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "TIMESTAMP" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 3, - "type": "TIMESTAMP" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "TIMESTAMP" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 6, - "type": "TIMESTAMP" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "TIMESTAMP" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "TIMESTAMP" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 6, - "type": "BIGINT" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 8, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 8, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 8, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "VARCHAR" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 11, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "TIMESTAMP" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 6, - "type": "TIMESTAMP" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "TIMESTAMP" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 8, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "TIMESTAMP" - }, - { - "column": 8, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(JOB=[$0], MGR0=[$2], DEPTNO=[$1], HIREDATE1=[$3], COMM1=[$4])\r\n LogicalAggregate(group=[{0, 2, 3}], HIREDATE1=[MAX($5)], COMM1=[SUM($6)])\r\n LogicalJoin(condition=[=($1, $4)], joinType=[inner])\r\n LogicalProject(JOB=[$0], SAL=[$3], DEPTNO=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 2}], HIREDATE1=[MAX($1)], COMM1=[SUM($3)])\r\n LogicalProject(MGR=[$1], HIREDATE=[$2], SAL=[$3], COMM=[$4])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(JOB=[$0], MGR0=[$2], DEPTNO=[$1], HIREDATE1=[$3], COMM1=[$4])\r\n LogicalAggregate(group=[{0, 1, 2}], HIREDATE1=[MAX($3)], COMM1=[SUM($4)])\r\n LogicalProject(JOB=[$0], DEPTNO=[$2], MGR=[$4], HIREDATE1=[$6], $f8=[CAST(*($3, $7)):INTEGER NOT NULL])\r\n LogicalJoin(condition=[=($1, $5)], joinType=[inner])\r\n LogicalAggregate(group=[{0, 1, 2}], agg#0=[COUNT()])\r\n LogicalProject(JOB=[$0], SAL=[$3], DEPTNO=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 2}], HIREDATE1=[MAX($1)], COMM1=[SUM($3)])\r\n LogicalProject(MGR=[$1], HIREDATE=[$2], SAL=[$3], COMM=[$4])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin1.json b/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin1.json deleted file mode 100644 index 747dc2a..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin1.json +++ /dev/null @@ -1,573 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB" - ], - "types": [ - "VARCHAR", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "NAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{0}])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin12.json b/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin12.json deleted file mode 100644 index ee8f173..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin12.json +++ /dev/null @@ -1,597 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB" - ], - "types": [ - "VARCHAR", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "NAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\r\n LogicalProject(JOB=[$1])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{0}])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(JOB=[$1])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin13.json b/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin13.json deleted file mode 100644 index 7f8826e..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin13.json +++ /dev/null @@ -1,597 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB" - ], - "types": [ - "VARCHAR", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "NAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[full])\r\n LogicalProject(JOB=[$1])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{0}])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[full])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(JOB=[$1])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin14.json b/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin14.json deleted file mode 100644 index 42b9118..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin14.json +++ /dev/null @@ -1,498 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "MGR" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - true - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(MGR=[$1], MGR0=[$0])\r\n LogicalProject(MGR0=[$1], MGR=[$0])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[full])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(MGR=[$1], MGR0=[$0])\r\n LogicalProject(MGR0=[$1], MGR=[$0])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[full])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin15.json b/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin15.json deleted file mode 100644 index eef618d..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin15.json +++ /dev/null @@ -1,802 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB", - "MGR" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - true - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 3}])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[full])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalProject(ENAME=[$0], JOB=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(JOB=[$1], MGR=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 3}])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[full])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalProject(ENAME=[$0], JOB=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(JOB=[$1], MGR=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin16.json b/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin16.json deleted file mode 100644 index 82b7f58..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin16.json +++ /dev/null @@ -1,1000 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "DEPTNO" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}])\r\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[full])\r\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\r\n LogicalFilter(condition=[=($1, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{0}])\r\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[full])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\r\n LogicalFilter(condition=[=($1, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin2.json b/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin2.json deleted file mode 100644 index a2305c3..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin2.json +++ /dev/null @@ -1,619 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB" - ], - "types": [ - "VARCHAR", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{1}])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\r\n LogicalProject(JOB=[$1])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{1}])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(JOB=[$1])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin3.json b/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin3.json deleted file mode 100644 index 517c32f..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin3.json +++ /dev/null @@ -1,802 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB", - "MGR" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - true - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 3}])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalProject(ENAME=[$0], JOB=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(JOB=[$1], MGR=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 3}])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalProject(ENAME=[$0], JOB=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(JOB=[$1], MGR=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin4.json b/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin4.json deleted file mode 100644 index 1352f45..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin4.json +++ /dev/null @@ -1,383 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB" - ], - "types": [ - "VARCHAR", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "NAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalProject(JOB=[$1])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(JOB=[$0])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(JOB=[$1])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin5.json b/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin5.json deleted file mode 100644 index 6c188dd..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin5.json +++ /dev/null @@ -1,597 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB" - ], - "types": [ - "VARCHAR", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "NAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{1}])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalProject(JOB=[$1])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{1}])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(JOB=[$1])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin6.json b/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin6.json deleted file mode 100644 index 67c3436..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin6.json +++ /dev/null @@ -1,391 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB" - ], - "types": [ - "VARCHAR", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "NAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - }, - { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalProject(JOB=[$1])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(JOB=[$1])\r\n LogicalFilter(condition=[=($0, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin7.json b/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin7.json deleted file mode 100644 index 22a2af3..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin7.json +++ /dev/null @@ -1,1000 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "DEPTNO" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}])\r\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\r\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\r\n LogicalFilter(condition=[=($1, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{0}])\r\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\r\n LogicalFilter(condition=[=($1, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin8.json b/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin8.json deleted file mode 100644 index b47be81..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin8.json +++ /dev/null @@ -1,1000 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "DEPTNO" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{2}])\r\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\r\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\r\n LogicalFilter(condition=[=($1, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{2}])\r\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\r\n LogicalFilter(condition=[=($1, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin9.json b/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin9.json deleted file mode 100644 index 49492fa..0000000 --- a/tests/RelOptRulesTest/testPushAggregateThroughOuterJoin9.json +++ /dev/null @@ -1,1036 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "DEPTNO" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'A'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "VARCHAR" - }, - { - "operator": "+", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 2}])\r\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\r\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\r\n LogicalFilter(condition=[=($1, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{0, 2}])\r\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\r\n LogicalFilter(condition=[=($1, 'A')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAvgGroupingSetsThroughUnion.json b/tests/RelOptRulesTest/testPushAvgGroupingSetsThroughUnion.json deleted file mode 100644 index 4dbc062..0000000 --- a/tests/RelOptRulesTest/testPushAvgGroupingSetsThroughUnion.json +++ /dev/null @@ -1,334 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "JOB", - "DEPTNO" - ], - "types": [ - "INTEGER", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "AVG", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "AVG", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[AVG($2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[AVG($2)])\r\n LogicalUnion(all=[true])\r\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushAvgThroughUnion.json b/tests/RelOptRulesTest/testPushAvgThroughUnion.json deleted file mode 100644 index 2f918f5..0000000 --- a/tests/RelOptRulesTest/testPushAvgThroughUnion.json +++ /dev/null @@ -1,271 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "AVG", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "AVG", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[AVG($1)])\r\n LogicalProject(ENAME=[$1], EMPNO=[$0])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[AVG($1)])\r\n LogicalUnion(all=[true])\r\n LogicalProject(ENAME=[$1], EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(ENAME=[$1], EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushBoolAndBoolOrThroughUnion.json b/tests/RelOptRulesTest/testPushBoolAndBoolOrThroughUnion.json deleted file mode 100644 index 04e6e24..0000000 --- a/tests/RelOptRulesTest/testPushBoolAndBoolOrThroughUnion.json +++ /dev/null @@ -1,935 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "operator": "MOD", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "operator": "MOD", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "BOOL_AND", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - }, - { - "operator": "BOOL_OR", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "operator": "MOD", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "operator": "MOD", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "operator": "MOD", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "BOOL_AND", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - }, - { - "operator": "BOOL_OR", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "operator": "MOD", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "operator": "MOD", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "BOOL_AND", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - }, - { - "operator": "BOOL_OR", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "operator": "MOD", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "BOOL_AND", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - }, - { - "operator": "BOOL_OR", - "operand": [ - { - "column": 3, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "operator": "MOD", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "BOOL_AND", - "operand": [ - { - "column": 3, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - }, - { - "operator": "BOOL_OR", - "operand": [ - { - "column": 3, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "operator": "MOD", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "operator": "MOD", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "BOOL_AND", - "operand": [ - { - "column": 3, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - }, - { - "operator": "BOOL_OR", - "operand": [ - { - "column": 3, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "operator": "MOD", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($1)])\r\n LogicalUnion(all=[true])\r\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($2)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($1)])\r\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($1)])\r\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushCountFilterThroughUnion.json b/tests/RelOptRulesTest/testPushCountFilterThroughUnion.json deleted file mode 100644 index 23f854c..0000000 --- a/tests/RelOptRulesTest/testPushCountFilterThroughUnion.json +++ /dev/null @@ -1,880 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'CLERK'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "union": [ - { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - ] - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'CLERK'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "union": [ - { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - ] - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'CLERK'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'CLERK'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'CLERK'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'CLERK'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 2, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'CLERK'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'CLERK'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'CLERK'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'CLERK'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT() FILTER $1])\r\n LogicalProject(DEPTNO=[$1], $f1=[=($0, 'CLERK')])\r\n LogicalUnion(all=[true])\r\n LogicalFilter(condition=[=($1, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($1, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT() FILTER $1])\r\n LogicalProject(DEPTNO=[$1], $f1=[=($0, 'CLERK')])\r\n LogicalFilter(condition=[=($1, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT() FILTER $1])\r\n LogicalProject(DEPTNO=[$1], $f1=[=($0, 'CLERK')])\r\n LogicalFilter(condition=[>($1, 20)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushCountNullableGroupingSetsThroughUnion.json b/tests/RelOptRulesTest/testPushCountNullableGroupingSetsThroughUnion.json deleted file mode 100644 index 4eda9f9..0000000 --- a/tests/RelOptRulesTest/testPushCountNullableGroupingSetsThroughUnion.json +++ /dev/null @@ -1,718 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "MGR", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - true, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 4, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT($2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[$SUM0($2)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT($2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT($2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushCountNullableThroughUnion.json b/tests/RelOptRulesTest/testPushCountNullableThroughUnion.json deleted file mode 100644 index 0f7f22d..0000000 --- a/tests/RelOptRulesTest/testPushCountNullableThroughUnion.json +++ /dev/null @@ -1,427 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "MGR" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - true - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 2, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1)])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushCountStarGroupingSetsThroughUnion.json b/tests/RelOptRulesTest/testPushCountStarGroupingSetsThroughUnion.json deleted file mode 100644 index c1254aa..0000000 --- a/tests/RelOptRulesTest/testPushCountStarGroupingSetsThroughUnion.json +++ /dev/null @@ -1,650 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 4, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT()])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[$SUM0($2)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushCountStarThroughUnion.json b/tests/RelOptRulesTest/testPushCountStarThroughUnion.json deleted file mode 100644 index 0c52fbe..0000000 --- a/tests/RelOptRulesTest/testPushCountStarThroughUnion.json +++ /dev/null @@ -1,399 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 2, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushFilterPastAgg.json b/tests/RelOptRulesTest/testPushFilterPastAgg.json deleted file mode 100644 index e4e4fd0..0000000 --- a/tests/RelOptRulesTest/testPushFilterPastAgg.json +++ /dev/null @@ -1,199 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "NAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'Charlie'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'Charlie'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'Charlie'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalFilter(condition=[=($0, 'Charlie')])\r\n LogicalAggregate(group=[{0}], C=[COUNT()])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{0}], C=[COUNT()])\r\n LogicalFilter(condition=[=($0, 'Charlie')])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushFilterPastAggFour.json b/tests/RelOptRulesTest/testPushFilterPastAggFour.json deleted file mode 100644 index 78b602b..0000000 --- a/tests/RelOptRulesTest/testPushFilterPastAggFour.json +++ /dev/null @@ -1,577 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "_ISO-8859-1'12'", - "operand": [], - "type": "CHAR" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 3, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "_ISO-8859-1'12'", - "operand": [], - "type": "CHAR" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "12", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "12", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 3, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "12", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "12", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{1}], EXPR$1=[$SUM0($2)])\r\n LogicalFilter(condition=[>($0, CAST('12'):INTEGER NOT NULL)])\r\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT()])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{1}], EXPR$1=[$SUM0($2)])\r\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT()])\r\n LogicalFilter(condition=[>($0, 12)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushFilterPastAggTwo.json b/tests/RelOptRulesTest/testPushFilterPastAggTwo.json deleted file mode 100644 index 19852f9..0000000 --- a/tests/RelOptRulesTest/testPushFilterPastAggTwo.json +++ /dev/null @@ -1,377 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "NAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'c'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "OR", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'z'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'b'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'b'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'z'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'c'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'b'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'c'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'b'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(C1=[$0])\r\n LogicalFilter(condition=[AND(>($0, 'c'), OR(>($1, 30), <($0, 'z')))])\r\n LogicalAggregate(group=[{0}], C2=[COUNT()])\r\n LogicalFilter(condition=[>($0, 'b')])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(C1=[$0])\r\n LogicalFilter(condition=[OR(>($1, 30), <($0, 'z'))])\r\n LogicalAggregate(group=[{0}], C2=[COUNT()])\r\n LogicalFilter(condition=[>($0, 'c')])\r\n LogicalFilter(condition=[>($0, 'b')])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushFilterPastAggWithGroupingSets2.json b/tests/RelOptRulesTest/testPushFilterPastAggWithGroupingSets2.json deleted file mode 100644 index e4e2150..0000000 --- a/tests/RelOptRulesTest/testPushFilterPastAggWithGroupingSets2.json +++ /dev/null @@ -1,334 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'Charlie'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'Charlie'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'Charlie'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(DNAME=[$0], DDEPTNO=[$1], C=[$2])\r\n LogicalFilter(condition=[=($0, 'Charlie')])\r\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]], C=[COUNT()])\r\n LogicalProject(DNAME=[$1], DDEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(DNAME=[$0], DDEPTNO=[$1], C=[$2])\r\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]], C=[COUNT()])\r\n LogicalFilter(condition=[=($0, 'Charlie')])\r\n LogicalProject(DNAME=[$1], DDEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushFilterPastProject.json b/tests/RelOptRulesTest/testPushFilterPastProject.json deleted file mode 100644 index 2bf65e7..0000000 --- a/tests/RelOptRulesTest/testPushFilterPastProject.json +++ /dev/null @@ -1,267 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "column": 1, - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "column": 2, - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(NAME=[$0])\r\n LogicalJoin(condition=[$1], joinType=[right])\r\n LogicalProject(NAME=[$0], $f4=[>($1, 10)])\r\n LogicalJoin(condition=[$2], joinType=[left])\r\n LogicalProject(NAME=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(DEPTNO=[$0], $f2=[>($0, 10)])\r\n LogicalProject(DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(NAME=[$0])\r\n LogicalJoin(condition=[true], joinType=[right])\r\n LogicalProject(NAME=[$0])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalProject(NAME=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalFilter(condition=[>($0, 10)])\r\n LogicalFilter(condition=[>($0, 10)])\r\n LogicalProject(DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushFilterSemijoin.json b/tests/RelOptRulesTest/testPushFilterSemijoin.json deleted file mode 100644 index 5b9c15f..0000000 --- a/tests/RelOptRulesTest/testPushFilterSemijoin.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "DNAME" - ], - "types": [ - "TINYINT", - "VARCHAR" - ], - "nullable": [ - false, - true - ], - "key": [ - [ - 0 - ], - [ - 1 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "EMPNO", - "SAL", - "DEPTNO" - ], - "types": [ - "SMALLINT", - "DECIMAL", - "TINYINT" - ], - "nullable": [ - false, - true, - true - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "TINYINT" - }, - { - "column": 4, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "DECIMAL" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "TINYINT" - }, - { - "column": 4, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "DECIMAL" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(DNAME=[$1])\r\n LogicalJoin(condition=[AND(=($0, $4), =($3, 100))], joinType=[semi])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n", - "LogicalProject(DNAME=[$1])\r\n LogicalJoin(condition=[=($0, $4)], joinType=[semi])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n LogicalFilter(condition=[=($1, 100)])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushFilterThroughSemiJoin.json b/tests/RelOptRulesTest/testPushFilterThroughSemiJoin.json deleted file mode 100644 index 922e4f6..0000000 --- a/tests/RelOptRulesTest/testPushFilterThroughSemiJoin.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "<=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "<=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - ], - "help": [ - "LogicalFilter(condition=[<=($0, 10)])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalJoin(condition=[=($0, $2)], joinType=[semi])\r\n LogicalFilter(condition=[<=($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushFilterWithIsNotDistinctFromPastJoin.json b/tests/RelOptRulesTest/testPushFilterWithIsNotDistinctFromPastJoin.json deleted file mode 100644 index b9b2731..0000000 --- a/tests/RelOptRulesTest/testPushFilterWithIsNotDistinctFromPastJoin.json +++ /dev/null @@ -1,334 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - }, - { - "column": 11, - "type": "VARCHAR" - }, - { - "column": 12, - "type": "INTEGER" - }, - { - "column": 13, - "type": "TIMESTAMP" - }, - { - "column": 14, - "type": "INTEGER" - }, - { - "column": 15, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - }, - { - "column": 17, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 10, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - }, - { - "column": 11, - "type": "VARCHAR" - }, - { - "column": 12, - "type": "INTEGER" - }, - { - "column": 13, - "type": "TIMESTAMP" - }, - { - "column": 14, - "type": "INTEGER" - }, - { - "column": 15, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - }, - { - "column": 17, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT DISTINCT FROM", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\r\n LogicalFilter(condition=[OR(AND(IS NULL($1), IS NULL($10)), IS TRUE(=($1, $10)))])\r\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\r\n LogicalJoin(condition=[AND(=($7, $16), IS NOT DISTINCT FROM($1, $10))], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushJoinCondDownToProject.json b/tests/RelOptRulesTest/testPushJoinCondDownToProject.json deleted file mode 100644 index e614849..0000000 --- a/tests/RelOptRulesTest/testPushJoinCondDownToProject.json +++ /dev/null @@ -1,187 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalFilter(condition=[=(+($0, 10), *($1, 2))])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], DEPTNO0=[$2])\r\n LogicalJoin(condition=[=($1, $3)], joinType=[inner])\r\n LogicalProject(DEPTNO=[$0], $f2=[+($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(DEPTNO=[$0], $f9=[*($0, 2)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushJoinThroughUnionOnLeft.json b/tests/RelOptRulesTest/testPushJoinThroughUnionOnLeft.json deleted file mode 100644 index 11bd95c..0000000 --- a/tests/RelOptRulesTest/testPushJoinThroughUnionOnLeft.json +++ /dev/null @@ -1,214 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "union": [ - { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - }, - "right": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "union": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - ], - "help": [ - "LogicalProject(SAL=[$0])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalUnion(all=[true])\r\n LogicalProject(SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalUnion(all=[true])\r\n LogicalProject(SAL=[$0])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalProject(SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(SAL=[$0])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalProject(SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushJoinThroughUnionOnRight.json b/tests/RelOptRulesTest/testPushJoinThroughUnionOnRight.json deleted file mode 100644 index c366c59..0000000 --- a/tests/RelOptRulesTest/testPushJoinThroughUnionOnRight.json +++ /dev/null @@ -1,213 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "union": [ - { - "project": { - "target": [ - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - } - } - }, - { - "union": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - ], - "help": [ - "LogicalProject(SAL=[$0])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalProject(SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalUnion(all=[true])\r\n LogicalProject(SLACKER=[$8])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(SLACKER=[$8])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalUnion(all=[true])\r\n LogicalProject(SAL=[$0])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalProject(SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(SAL=[$0])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalProject(SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushMaxNullableGroupingSetsThroughUnion.json b/tests/RelOptRulesTest/testPushMaxNullableGroupingSetsThroughUnion.json deleted file mode 100644 index b96c201..0000000 --- a/tests/RelOptRulesTest/testPushMaxNullableGroupingSetsThroughUnion.json +++ /dev/null @@ -1,718 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "MGR", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - true, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MAX($2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MAX($2)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushMaxNullableThroughUnion.json b/tests/RelOptRulesTest/testPushMaxNullableThroughUnion.json deleted file mode 100644 index d973023..0000000 --- a/tests/RelOptRulesTest/testPushMaxNullableThroughUnion.json +++ /dev/null @@ -1,427 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "MGR" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - true - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushMinGroupingSetsThroughUnion.json b/tests/RelOptRulesTest/testPushMinGroupingSetsThroughUnion.json deleted file mode 100644 index ac9633a..0000000 --- a/tests/RelOptRulesTest/testPushMinGroupingSetsThroughUnion.json +++ /dev/null @@ -1,722 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "JOB", - "DEPTNO" - ], - "types": [ - "INTEGER", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 5, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 5, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MIN($2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MIN($2)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MIN($2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MIN($2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushMinThroughUnion.json b/tests/RelOptRulesTest/testPushMinThroughUnion.json deleted file mode 100644 index b8e22f2..0000000 --- a/tests/RelOptRulesTest/testPushMinThroughUnion.json +++ /dev/null @@ -1,571 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\r\n LogicalProject(ENAME=[$1], EMPNO=[$0])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\r\n LogicalProject(ENAME=[$1], EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\r\n LogicalProject(ENAME=[$1], EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectPastFilter.json b/tests/RelOptRulesTest/testPushProjectPastFilter.json deleted file mode 100644 index 1dfae48..0000000 --- a/tests/RelOptRulesTest/testPushProjectPastFilter.json +++ /dev/null @@ -1,198 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "INTEGER", - "VARCHAR", - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "operator": "UPPER", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'FOO'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "operator": "UPPER", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'FOO'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[+($0, $4)])\r\n LogicalFilter(condition=[AND(=($2, *(10, $3)), =(UPPER($1), 'FOO'))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[+($0, $4)])\r\n LogicalFilter(condition=[AND(=($2, *(10, $3)), =(UPPER($1), 'FOO'))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectPastFilter2.json b/tests/RelOptRulesTest/testPushProjectPastFilter2.json deleted file mode 100644 index 88ca1cb..0000000 --- a/tests/RelOptRulesTest/testPushProjectPastFilter2.json +++ /dev/null @@ -1,210 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "MGR" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - true - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "filter": { - "condition": { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\r\n LogicalFilter(condition=[CASE(<($0, 10), true, false)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\r\n LogicalFilter(condition=[<($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectPastFilter3b.json b/tests/RelOptRulesTest/testPushProjectPastFilter3b.json deleted file mode 100644 index 8118c27..0000000 --- a/tests/RelOptRulesTest/testPushProjectPastFilter3b.json +++ /dev/null @@ -1,308 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "operator": "UPPER", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'FOO'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 8, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "TIMESTAMP" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "column": 7, - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "operator": "UPPER", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'FOO'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(X=[+($0, $7)], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\r\n LogicalFilter(condition=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(X=[$8], ENAME=[$0], JOB=[$1], MGR=[$2], HIREDATE=[$3], SAL=[$4], COMM=[$5], SLACKER=[$6])\r\n LogicalFilter(condition=[$7])\r\n LogicalProject(ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], $f7=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))], $f8=[+($0, $7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectPastFilter3c.json b/tests/RelOptRulesTest/testPushProjectPastFilter3c.json deleted file mode 100644 index 7b2289b..0000000 --- a/tests/RelOptRulesTest/testPushProjectPastFilter3c.json +++ /dev/null @@ -1,304 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "operator": "UPPER", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'FOO'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "TIMESTAMP" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "operator": "UPPER", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'FOO'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(X=[+($0, $7)], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\r\n LogicalFilter(condition=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(X=[$7], ENAME=[$0], JOB=[$1], MGR=[$2], HIREDATE=[$3], SAL=[$4], COMM=[$5], SLACKER=[$6])\r\n LogicalFilter(condition=[AND(=($4, *(10, $5)), =(UPPER($0), 'FOO'))])\r\n LogicalProject(ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], $f7=[+($0, $7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectPastFullJoin.json b/tests/RelOptRulesTest/testPushProjectPastFullJoin.json deleted file mode 100644 index e503bf8..0000000 --- a/tests/RelOptRulesTest/testPushProjectPastFullJoin.json +++ /dev/null @@ -1,499 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "SAL" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "BONUS", - "fields": [ - "ENAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[CASE(<($1, 11), 11, *(-1, $1))])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[full])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n", - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[CASE($1, 11, $2)])\r\n LogicalJoin(condition=[=($0, $3)], joinType=[full])\r\n LogicalProject(ENAME=[$0], EXPR$0=[<($1, 11)], EXPR$1=[*(-1, $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectPastFullJoinStrong.json b/tests/RelOptRulesTest/testPushProjectPastFullJoinStrong.json deleted file mode 100644 index babffa5..0000000 --- a/tests/RelOptRulesTest/testPushProjectPastFullJoinStrong.json +++ /dev/null @@ -1,487 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "SAL" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "BONUS", - "fields": [ - "ENAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[CASE(<($1, 11), *(-1, $1), $1)])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[full])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n", - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[full])\r\n LogicalProject(ENAME=[$0], EXPR$1=[CASE(<($1, 11), *(-1, $1), $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectPastInnerJoin.json b/tests/RelOptRulesTest/testPushProjectPastInnerJoin.json deleted file mode 100644 index d6c2ef1..0000000 --- a/tests/RelOptRulesTest/testPushProjectPastInnerJoin.json +++ /dev/null @@ -1,491 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "SAL" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "BONUS", - "fields": [ - "ENAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[CASE(<($1, 11), 11, *(-1, $1))])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n", - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalProject(ENAME=[$0], EXPR$1=[CASE(<($1, 11), 11, *(-1, $1))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectPastInnerJoinStrong.json b/tests/RelOptRulesTest/testPushProjectPastInnerJoinStrong.json deleted file mode 100644 index ca72592..0000000 --- a/tests/RelOptRulesTest/testPushProjectPastInnerJoinStrong.json +++ /dev/null @@ -1,487 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "SAL" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "BONUS", - "fields": [ - "ENAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[CASE(<($1, 11), *(-1, $1), $1)])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n", - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalProject(ENAME=[$0], EXPR$1=[CASE(<($1, 11), *(-1, $1), $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectPastJoin.json b/tests/RelOptRulesTest/testPushProjectPastJoin.json deleted file mode 100644 index 6f505ec..0000000 --- a/tests/RelOptRulesTest/testPushProjectPastJoin.json +++ /dev/null @@ -1,197 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "BONUS", - "fields": [ - "ENAME", - "COMM" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[+($1, $4)])\r\n LogicalJoin(condition=[AND(=($0, $3), =($2, 10))], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n", - "LogicalProject(EXPR$0=[+($1, $4)])\r\n LogicalJoin(condition=[AND(=($0, $3), $2)], joinType=[inner])\r\n LogicalProject(ENAME=[$0], SAL=[$1], EXPR$0=[=($2, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectPastLeftJoin.json b/tests/RelOptRulesTest/testPushProjectPastLeftJoin.json deleted file mode 100644 index 7d53e6e..0000000 --- a/tests/RelOptRulesTest/testPushProjectPastLeftJoin.json +++ /dev/null @@ -1,491 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "SAL" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "BONUS", - "fields": [ - "ENAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[CASE(<($1, 11), 11, *(-1, $1))])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n", - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\r\n LogicalProject(ENAME=[$0], EXPR$1=[CASE(<($1, 11), 11, *(-1, $1))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectPastLeftJoinSwap.json b/tests/RelOptRulesTest/testPushProjectPastLeftJoinSwap.json deleted file mode 100644 index 2fc2e3d..0000000 --- a/tests/RelOptRulesTest/testPushProjectPastLeftJoinSwap.json +++ /dev/null @@ -1,499 +0,0 @@ -{ - "schemas": [ - { - "name": "BONUS", - "fields": [ - "ENAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "ENAME", - "SAL" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "column": 3, - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[CASE(<($2, 11), 11, *(-1, $2))])\r\n LogicalJoin(condition=[=($1, $0)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[CASE($2, 11, $3)])\r\n LogicalJoin(condition=[=($1, $0)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n LogicalProject(ENAME=[$0], EXPR$0=[<($1, 11)], EXPR$1=[*(-1, $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectPastLeftJoinSwapStrong.json b/tests/RelOptRulesTest/testPushProjectPastLeftJoinSwapStrong.json deleted file mode 100644 index 46018de..0000000 --- a/tests/RelOptRulesTest/testPushProjectPastLeftJoinSwapStrong.json +++ /dev/null @@ -1,487 +0,0 @@ -{ - "schemas": [ - { - "name": "BONUS", - "fields": [ - "ENAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "ENAME", - "SAL" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[CASE(<($2, 11), *(-1, $2), $2)])\r\n LogicalJoin(condition=[=($1, $0)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[$2])\r\n LogicalJoin(condition=[=($1, $0)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n LogicalProject(ENAME=[$0], EXPR$1=[CASE(<($1, 11), *(-1, $1), $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectPastRightJoin.json b/tests/RelOptRulesTest/testPushProjectPastRightJoin.json deleted file mode 100644 index f30d68f..0000000 --- a/tests/RelOptRulesTest/testPushProjectPastRightJoin.json +++ /dev/null @@ -1,499 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "SAL" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "BONUS", - "fields": [ - "ENAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "column": 1, - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "column": 2, - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[CASE(<($1, 11), 11, *(-1, $1))])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n", - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[CASE($1, 11, $2)])\r\n LogicalJoin(condition=[=($0, $3)], joinType=[right])\r\n LogicalProject(ENAME=[$0], EXPR$0=[<($1, 11)], EXPR$1=[*(-1, $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectPastRightJoinStrong.json b/tests/RelOptRulesTest/testPushProjectPastRightJoinStrong.json deleted file mode 100644 index 2dcfe68..0000000 --- a/tests/RelOptRulesTest/testPushProjectPastRightJoinStrong.json +++ /dev/null @@ -1,487 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "SAL" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "BONUS", - "fields": [ - "ENAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[CASE(<($1, 11), *(-1, $1), $1)])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n", - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\r\n LogicalProject(ENAME=[$0], EXPR$1=[CASE(<($1, 11), *(-1, $1), $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectPastRightJoinSwap.json b/tests/RelOptRulesTest/testPushProjectPastRightJoinSwap.json deleted file mode 100644 index a7efdfd..0000000 --- a/tests/RelOptRulesTest/testPushProjectPastRightJoinSwap.json +++ /dev/null @@ -1,491 +0,0 @@ -{ - "schemas": [ - { - "name": "BONUS", - "fields": [ - "ENAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "ENAME", - "SAL" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[CASE(<($2, 11), 11, *(-1, $2))])\r\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[$2])\r\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n LogicalProject(ENAME=[$0], EXPR$1=[CASE(<($1, 11), 11, *(-1, $1))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectPastRightJoinSwapStrong.json b/tests/RelOptRulesTest/testPushProjectPastRightJoinSwapStrong.json deleted file mode 100644 index 1958c26..0000000 --- a/tests/RelOptRulesTest/testPushProjectPastRightJoinSwapStrong.json +++ /dev/null @@ -1,487 +0,0 @@ -{ - "schemas": [ - { - "name": "BONUS", - "fields": [ - "ENAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "ENAME", - "SAL" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "<", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "*", - "operand": [ - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[CASE(<($2, 11), *(-1, $2), $2)])\r\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\r\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\r\n LogicalProject(EXPR$1=[$2])\r\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n LogicalProject(ENAME=[$0], EXPR$1=[CASE(<($1, 11), *(-1, $1), $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectPastSetOp.json b/tests/RelOptRulesTest/testPushProjectPastSetOp.json deleted file mode 100644 index dbe39c3..0000000 --- a/tests/RelOptRulesTest/testPushProjectPastSetOp.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - }, - { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - ], - "help": [ - "LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectWithIsNotDistinctFromPastJoin.json b/tests/RelOptRulesTest/testPushProjectWithIsNotDistinctFromPastJoin.json deleted file mode 100644 index 5c67ac5..0000000 --- a/tests/RelOptRulesTest/testPushProjectWithIsNotDistinctFromPastJoin.json +++ /dev/null @@ -1,307 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "BONUS", - "fields": [ - "ENAME", - "JOB", - "COMM" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "IS NOT DISTINCT FROM", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "||", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "||", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "IS NOT DISTINCT FROM", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "||", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "||", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[+($0, $3)])\r\n LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($2, $4), =($1, 10))], joinType=[inner])\r\n LogicalProject(SAL=[$2], DEPTNO=[$3], $f9=[||($0, $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(COMM=[$2], $f4=[||($0, $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n", - "LogicalProject(EXPR$0=[+($0, $3)])\r\n LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($1, $4), $2)], joinType=[inner])\r\n LogicalProject(SAL=[$0], $f9=[$2], EXPR$0=[=($1, 10)])\r\n LogicalProject(SAL=[$2], DEPTNO=[$3], $f9=[||($0, $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(COMM=[$2], $f4=[||($0, $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectWithOverPastJoin1.json b/tests/RelOptRulesTest/testPushProjectWithOverPastJoin1.json deleted file mode 100644 index 0fb089f..0000000 --- a/tests/RelOptRulesTest/testPushProjectWithOverPastJoin1.json +++ /dev/null @@ -1,218 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "BONUS", - "fields": [ - "ENAME", - "COMM" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "error": "Not implemented: COUNT" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "error": "Not implemented: COUNT" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "column": 4, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[+($2, $5)], EXPR$1=[COUNT($0) OVER (PARTITION BY $3)])\r\n LogicalJoin(condition=[AND(=($1, $4), =($3, 10))], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n", - "LogicalProject(EXPR$0=[+($2, $6)], EXPR$1=[COUNT($0) OVER (PARTITION BY $3)])\r\n LogicalJoin(condition=[AND(=($1, $5), $4)], joinType=[inner])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], SAL=[$2], DEPTNO=[$3], EXPR$0=[=($3, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectWithOverPastJoin2.json b/tests/RelOptRulesTest/testPushProjectWithOverPastJoin2.json deleted file mode 100644 index f51791a..0000000 --- a/tests/RelOptRulesTest/testPushProjectWithOverPastJoin2.json +++ /dev/null @@ -1,209 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "BONUS", - "fields": [ - "ENAME", - "JOB", - "SAL", - "COMM" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "error": "Not implemented: COUNT" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "error": "Not implemented: COUNT" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[+($1, $6)], EXPR$1=[COUNT($5) OVER (PARTITION BY $4)])\r\n LogicalJoin(condition=[AND(=($0, $3), =($2, 10))], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n", - "LogicalProject(EXPR$0=[+($1, $6)], EXPR$1=[COUNT($5) OVER (PARTITION BY $4)])\r\n LogicalJoin(condition=[AND(=($0, $3), $2)], joinType=[inner])\r\n LogicalProject(ENAME=[$0], SAL=[$1], EXPR$0=[=($2, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushProjectWithOverPastJoin3.json b/tests/RelOptRulesTest/testPushProjectWithOverPastJoin3.json deleted file mode 100644 index e153f67..0000000 --- a/tests/RelOptRulesTest/testPushProjectWithOverPastJoin3.json +++ /dev/null @@ -1,252 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "BONUS", - "fields": [ - "ENAME", - "JOB", - "SAL", - "COMM" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "error": "Not implemented: SUM" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "error": "Not implemented: SUM" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "+", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[+($1, $6)], EXPR$1=[SUM(+(+($5, $5), 100)) OVER (PARTITION BY $4)])\r\n LogicalJoin(condition=[AND(=($0, $3), =($2, 10))], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n", - "LogicalProject(EXPR$0=[+($1, $5)], EXPR$1=[SUM($6) OVER (PARTITION BY $4)])\r\n LogicalJoin(condition=[AND(=($0, $3), $2)], joinType=[inner])\r\n LogicalProject(ENAME=[$0], SAL=[$1], EXPR$0=[=($2, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(ENAME=[$0], JOB=[$1], COMM=[$3], EXPR$0=[+(+($2, $2), 100)])\r\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushSemiJoinConditions.json b/tests/RelOptRulesTest/testPushSemiJoinConditions.json deleted file mode 100644 index ebf3f6a..0000000 --- a/tests/RelOptRulesTest/testPushSemiJoinConditions.json +++ /dev/null @@ -1,249 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "DEPTNO" - ], - "types": [ - "SMALLINT", - "VARCHAR", - "TINYINT" - ], - "nullable": [ - false, - true, - true - ], - "key": [ - [ - 0 - ], - [ - 1 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "DNAME" - ], - "types": [ - "TINYINT", - "VARCHAR" - ], - "nullable": [ - false, - true - ], - "key": [ - [ - 0 - ], - [ - 1 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "TINYINT" - } - ], - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "TINYINT" - }, - { - "column": 2, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 0, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 2, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "OR", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 2, - "type": "TINYINT" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 2, - "type": "TINYINT" - } - ], - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "IS NOT DISTINCT FROM", - "operand": [ - { - "column": 2, - "type": "TINYINT" - }, - { - "column": 3, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT DISTINCT FROM", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0])\r\n LogicalJoin(condition=[AND(OR(=($0, $2), AND(IS NULL($0), IS NULL($2))), OR(=($1, $3), AND(IS NULL($1), IS NULL($3))))], joinType=[semi])\r\n LogicalProject(DEPTNO=[$2], ENAME=[$1])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n", - "LogicalProject(DEPTNO=[$2])\r\n LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($2, $3), IS NOT DISTINCT FROM($1, $4))], joinType=[semi])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushSemiJoinPastFilter.json b/tests/RelOptRulesTest/testPushSemiJoinPastFilter.json deleted file mode 100644 index 634de7e..0000000 --- a/tests/RelOptRulesTest/testPushSemiJoinPastFilter.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'foo'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'foo'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalProject(ENAME=[$0])\r\n LogicalFilter(condition=[AND(=($1, $2), =($0, 'foo'))])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(ENAME=[$0])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\r\n LogicalFilter(condition=[=($0, 'foo')])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushSemiJoinPastJoinRuleLeft.json b/tests/RelOptRulesTest/testPushSemiJoinPastJoinRuleLeft.json deleted file mode 100644 index b618ba6..0000000 --- a/tests/RelOptRulesTest/testPushSemiJoinPastJoinRuleLeft.json +++ /dev/null @@ -1,260 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "DEPTNO" - ], - "types": [ - "INTEGER", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(ENAME=[$1])\r\n LogicalFilter(condition=[AND(=($2, $3), =($0, $4))])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(ENAME=[$1])\r\n LogicalJoin(condition=[=($0, $4)], joinType=[inner])\r\n LogicalJoin(condition=[=($2, $3)], joinType=[inner])\r\n LogicalJoin(condition=[=($0, $3)], joinType=[semi])\r\n LogicalJoin(condition=[=($2, $3)], joinType=[semi])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushSemiJoinPastJoinRuleRight.json b/tests/RelOptRulesTest/testPushSemiJoinPastJoinRuleRight.json deleted file mode 100644 index 206d2c5..0000000 --- a/tests/RelOptRulesTest/testPushSemiJoinPastJoinRuleRight.json +++ /dev/null @@ -1,253 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 1 - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(ENAME=[$0])\r\n LogicalFilter(condition=[AND(=($1, $2), =($2, $3))])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(ENAME=[$0])\r\n LogicalJoin(condition=[=($2, $3)], joinType=[inner])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[semi])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushSemiJoinPastProject.json b/tests/RelOptRulesTest/testPushSemiJoinPastProject.json deleted file mode 100644 index 2098439..0000000 --- a/tests/RelOptRulesTest/testPushSemiJoinPastProject.json +++ /dev/null @@ -1,274 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "TRIM", - "operand": [ - { - "operator": "BOTH", - "operand": [], - "type": "SYMBOL" - }, - { - "operator": "_ISO-8859-1' '", - "operand": [], - "type": "CHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - }, - { - "operator": "*", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "TRIM", - "operand": [ - { - "operator": "BOTH", - "operand": [], - "type": "SYMBOL" - }, - { - "operator": "_ISO-8859-1' '", - "operand": [], - "type": "CHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - }, - { - "operator": "*", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalProject(ENAME=[$0], EXPR$1=[$1], EXPR$2=[$2], DEPTNO=[$3])\r\n LogicalFilter(condition=[=($3, $4)])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalProject(ENAME=[$0], EXPR$1=[TRIM(FLAG(BOTH), ' ', $1)], EXPR$2=[*($2, 2)], DEPTNO=[$3])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(ENAME=[$0], EXPR$1=[$1], EXPR$2=[$2], DEPTNO=[$3])\r\n LogicalJoin(condition=[=($3, $4)], joinType=[inner])\r\n LogicalProject(ENAME=[$0], EXPR$1=[TRIM(FLAG(BOTH), ' ', $1)], EXPR$2=[*($2, 2)], DEPTNO=[$3])\r\n LogicalJoin(condition=[=($3, $4)], joinType=[semi])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushSumConstantGroupingSetsThroughUnion.json b/tests/RelOptRulesTest/testPushSumConstantGroupingSetsThroughUnion.json deleted file mode 100644 index 02e6aa7..0000000 --- a/tests/RelOptRulesTest/testPushSumConstantGroupingSetsThroughUnion.json +++ /dev/null @@ -1,799 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0], U=[$2])\r\n LogicalUnion(all=[true])\r\n LogicalProject(JOB=[$0], DEPTNO=[$1], U=[2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(JOB=[$0], DEPTNO=[$1], U=[3])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0], U=[2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0], U=[3])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushSumConstantThroughUnion.json b/tests/RelOptRulesTest/testPushSumConstantThroughUnion.json deleted file mode 100644 index 6f4adfa..0000000 --- a/tests/RelOptRulesTest/testPushSumConstantThroughUnion.json +++ /dev/null @@ -1,604 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalUnion(all=[true])\r\n LogicalProject(ENAME=[$0], U=[2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(ENAME=[$0], U=[3])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalProject(ENAME=[$0], U=[2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalProject(ENAME=[$0], U=[3])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushSumCountStarGroupingSetsThroughUnion.json b/tests/RelOptRulesTest/testPushSumCountStarGroupingSetsThroughUnion.json deleted file mode 100644 index 1b2d2e9..0000000 --- a/tests/RelOptRulesTest/testPushSumCountStarGroupingSetsThroughUnion.json +++ /dev/null @@ -1,913 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "JOB", - "DEPTNO" - ], - "types": [ - "INTEGER", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "$SUM0", - "operand": [ - { - "column": 5, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 5, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 5, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)], EXPR$3=[COUNT()], EXPR$4=[MIN($0)], EXPR$5=[MAX($2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)], EXPR$3=[$SUM0($3)], EXPR$4=[MIN($4)], EXPR$5=[MAX($5)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)], EXPR$3=[COUNT()], EXPR$4=[MIN($0)], EXPR$5=[MAX($2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)], EXPR$3=[COUNT()], EXPR$4=[MIN($0)], EXPR$5=[MAX($2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushSumCountStarThroughUnion.json b/tests/RelOptRulesTest/testPushSumCountStarThroughUnion.json deleted file mode 100644 index 3c7faf0..0000000 --- a/tests/RelOptRulesTest/testPushSumCountStarThroughUnion.json +++ /dev/null @@ -1,805 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "DEPTNO" - ], - "types": [ - "INTEGER", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "$SUM0", - "operand": [ - { - "column": 3, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT()], EXPR$3=[MIN($2)], EXPR$4=[MAX($1)])\r\n LogicalProject(ENAME=[$1], EMPNO=[$0], DEPTNO=[$2])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[$SUM0($2)], EXPR$3=[MIN($3)], EXPR$4=[MAX($4)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT()], EXPR$3=[MIN($2)], EXPR$4=[MAX($1)])\r\n LogicalProject(ENAME=[$1], EMPNO=[$0], DEPTNO=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT()], EXPR$3=[MIN($2)], EXPR$4=[MAX($1)])\r\n LogicalProject(ENAME=[$1], EMPNO=[$0], DEPTNO=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushSumNullConstantGroupingSetsThroughUnion.json b/tests/RelOptRulesTest/testPushSumNullConstantGroupingSetsThroughUnion.json deleted file mode 100644 index 9d451fd..0000000 --- a/tests/RelOptRulesTest/testPushSumNullConstantGroupingSetsThroughUnion.json +++ /dev/null @@ -1,799 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0], U=[$2])\r\n LogicalUnion(all=[true])\r\n LogicalProject(JOB=[$0], DEPTNO=[$1], U=[null:INTEGER])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(JOB=[$0], DEPTNO=[$1], U=[null:INTEGER])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0], U=[null:INTEGER])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\r\n LogicalProject(DEPTNO=[$1], JOB=[$0], U=[null:INTEGER])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushSumNullConstantThroughUnion.json b/tests/RelOptRulesTest/testPushSumNullConstantThroughUnion.json deleted file mode 100644 index 3913307..0000000 --- a/tests/RelOptRulesTest/testPushSumNullConstantThroughUnion.json +++ /dev/null @@ -1,604 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalUnion(all=[true])\r\n LogicalProject(ENAME=[$0], U=[null:INTEGER])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(ENAME=[$0], U=[null:INTEGER])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalProject(ENAME=[$0], U=[null:INTEGER])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalProject(ENAME=[$0], U=[null:INTEGER])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushSumNullableGroupingSetsThroughUnion.json b/tests/RelOptRulesTest/testPushSumNullableGroupingSetsThroughUnion.json deleted file mode 100644 index e1c048e..0000000 --- a/tests/RelOptRulesTest/testPushSumNullableGroupingSetsThroughUnion.json +++ /dev/null @@ -1,718 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "MGR", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - true, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\r\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushSumNullableNOGBYThroughUnion.json b/tests/RelOptRulesTest/testPushSumNullableNOGBYThroughUnion.json deleted file mode 100644 index df3b353..0000000 --- a/tests/RelOptRulesTest/testPushSumNullableNOGBYThroughUnion.json +++ /dev/null @@ -1,304 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "MGR" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - true - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testPushSumNullableThroughUnion.json b/tests/RelOptRulesTest/testPushSumNullableThroughUnion.json deleted file mode 100644 index 6c839c9..0000000 --- a/tests/RelOptRulesTest/testPushSumNullableThroughUnion.json +++ /dev/null @@ -1,427 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "MGR" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - true - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ] - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalUnion(all=[true])\r\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceAggregateFunctionsByGroup.json b/tests/RelOptRulesTest/testReduceAggregateFunctionsByGroup.json deleted file mode 100644 index 9361ebe..0000000 --- a/tests/RelOptRulesTest/testReduceAggregateFunctionsByGroup.json +++ /dev/null @@ -1,306 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "AVG", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "ANY_VALUE", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "FIRST_VALUE", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "LAST_VALUE", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalProject(SAL=[$0], SAL_MAX=[$2], SAL_MIN=[$3], SAL_AVG=[$4], SAL_VAL=[$5], SAL_FIRST=[$6], SAL_LAST=[$7])\r\n LogicalAggregate(group=[{0, 1}], SAL_MAX=[MAX($0)], SAL_MIN=[MIN($0)], SAL_AVG=[AVG($0)], SAL_VAL=[ANY_VALUE($0)], SAL_FIRST=[FIRST_VALUE($0)], SAL_LAST=[LAST_VALUE($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(SAL=[$0], SAL_MAX=[$0], SAL_MIN=[$0], SAL_AVG=[$0], SAL_VAL=[$0], SAL_FIRST=[$0], SAL_LAST=[$0])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceAllAggregateFunctions.json b/tests/RelOptRulesTest/testReduceAllAggregateFunctions.json deleted file mode 100644 index 9ea144d..0000000 --- a/tests/RelOptRulesTest/testReduceAllAggregateFunctions.json +++ /dev/null @@ -1,664 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "STDDEV_POP", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "AVG", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "STDDEV_SAMP", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "VAR_POP", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "VAR_SAMP", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "POWER", - "operand": [ - { - "operator": "/", - "operand": [ - { - "operator": "-", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "/", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "BIGINT" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - }, - { - "operator": "0.5", - "operand": [], - "type": "DECIMAL" - } - ], - "type": "DOUBLE" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "/", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "POWER", - "operand": [ - { - "operator": "/", - "operand": [ - { - "operator": "-", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "/", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "BIGINT" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "BIGINT" - }, - { - "operator": "-", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "BIGINT" - }, - { - "operator": "0.5", - "operand": [], - "type": "DECIMAL" - } - ], - "type": "DOUBLE" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "/", - "operand": [ - { - "operator": "-", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "/", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "BIGINT" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "/", - "operand": [ - { - "operator": "-", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "/", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "BIGINT" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "BIGINT" - }, - { - "operator": "-", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "$SUM0", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[STDDEV_SAMP($1)], EXPR$4=[VAR_POP($1)], EXPR$5=[VAR_SAMP($1)])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(NAME=[$0], EXPR$1=[CAST(POWER(/(-($1, /(*($2, $2), $3)), $3), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[CAST(POWER(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1))), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$4=[CAST(/(-($1, /(*($2, $2), $3)), $3)):INTEGER NOT NULL], EXPR$5=[CAST(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1)))):INTEGER NOT NULL])\r\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($2)], agg#1=[$SUM0($1)], agg#2=[COUNT()])\r\n LogicalProject(NAME=[$0], DEPTNO=[$1], $f2=[*($1, $1)])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceAverage.json b/tests/RelOptRulesTest/testReduceAverage.json deleted file mode 100644 index 9df2406..0000000 --- a/tests/RelOptRulesTest/testReduceAverage.json +++ /dev/null @@ -1,284 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "VARCHAR" - }, - { - "operator": "AVG", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "/", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[MAX($0)], EXPR$2=[AVG($1)], EXPR$3=[MIN($0)])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(NAME=[$0], EXPR$1=[$0], EXPR$2=[CAST(/($1, $2)):INTEGER NOT NULL], EXPR$3=[$0])\r\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1)], agg#1=[COUNT()])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceAverageAndSumWithNoReduceStddevAndVar.json b/tests/RelOptRulesTest/testReduceAverageAndSumWithNoReduceStddevAndVar.json deleted file mode 100644 index 393f253..0000000 --- a/tests/RelOptRulesTest/testReduceAverageAndSumWithNoReduceStddevAndVar.json +++ /dev/null @@ -1,308 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "STDDEV_POP", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "AVG", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "VAR_POP", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "/", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "STDDEV_POP", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "$SUM0", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "VAR_POP", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[VAR_POP($1)])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(NAME=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[$4])\r\n LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], agg#1=[$SUM0($1)], agg#2=[COUNT()], EXPR$3=[VAR_POP($1)])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceAverageAndVarWithNoReduceStddev.json b/tests/RelOptRulesTest/testReduceAverageAndVarWithNoReduceStddev.json deleted file mode 100644 index 276eba8..0000000 --- a/tests/RelOptRulesTest/testReduceAverageAndVarWithNoReduceStddev.json +++ /dev/null @@ -1,410 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "STDDEV_POP", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "AVG", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "VAR_POP", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "/", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "/", - "operand": [ - { - "operator": "-", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "/", - "operand": [ - { - "operator": "*", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "BIGINT" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "STDDEV_POP", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "*", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[VAR_POP($1)])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(NAME=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[CAST(/(-($4, /(*($2, $2), $3)), $3)):INTEGER NOT NULL])\r\n LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], agg#1=[SUM($1)], agg#2=[COUNT()], agg#3=[SUM($2)])\r\n LogicalProject(NAME=[$0], DEPTNO=[$1], $f2=[*($1, $1)])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceAverageWithNoReduceSum.json b/tests/RelOptRulesTest/testReduceAverageWithNoReduceSum.json deleted file mode 100644 index 3f48be7..0000000 --- a/tests/RelOptRulesTest/testReduceAverageWithNoReduceSum.json +++ /dev/null @@ -1,284 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MAX", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "VARCHAR" - }, - { - "operator": "AVG", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "/", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[MAX($0)], EXPR$2=[AVG($1)], EXPR$3=[MIN($0)])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(NAME=[$0], EXPR$1=[$0], EXPR$2=[CAST(/($1, $2)):INTEGER NOT NULL], EXPR$3=[$0])\r\n LogicalAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[COUNT()])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceCase.json b/tests/RelOptRulesTest/testReduceCase.json deleted file mode 100644 index 351fd58..0000000 --- a/tests/RelOptRulesTest/testReduceCase.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "2.1", - "operand": [], - "type": "FLOAT" - }, - { - "operator": "1", - "operand": [], - "type": "FLOAT" - } - ], - "type": "FLOAT" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "FLOAT" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(NEWCOL=[CASE(false, 2.1:FLOAT, 1:FLOAT)])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(NEWCOL=[1E0:FLOAT])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceCaseNullabilityChange.json b/tests/RelOptRulesTest/testReduceCaseNullabilityChange.json deleted file mode 100644 index 5c2489a..0000000 --- a/tests/RelOptRulesTest/testReduceCaseNullabilityChange.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "IS NOT NULL", - "operand": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "operator": "CAST", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ], - "help": [ - "LogicalProject(QX=[CASE(=($0, 1), 1, IS NOT NULL(1), 2, null:INTEGER)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(QX=[CAST(CASE(=($0, 1), 1, 2)):INTEGER])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceCastAndConsts.json b/tests/RelOptRulesTest/testReduceCastAndConsts.json deleted file mode 100644 index 0a94c38..0000000 --- a/tests/RelOptRulesTest/testReduceCastAndConsts.json +++ /dev/null @@ -1,219 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "operator": "CAST", - "operand": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "/", - "operand": [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "13", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "13", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=(CAST(+($0, /(10, 2))):INTEGER NOT NULL, 13)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[=(+($0, 5), 13)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceCasts.json b/tests/RelOptRulesTest/testReduceCasts.json deleted file mode 100644 index b671f1a..0000000 --- a/tests/RelOptRulesTest/testReduceCasts.json +++ /dev/null @@ -1,307 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "EMPNO", - "JOB", - "DEPTNO" - ], - "types": [ - "INTEGER", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "CAST", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "operator": "CAST", - "operand": [ - { - "operator": "CAST", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'Manager'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "CAST", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "operator": "CAST", - "operand": [ - { - "operator": "CAST", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'Manager'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[CAST($0):VARCHAR(128) NOT NULL], EXPR$1=[CAST($1):INTEGER NOT NULL])\r\n LogicalFilter(condition=[=(CAST(CAST($2):VARCHAR(1) NOT NULL):VARCHAR(7) NOT NULL, 'Manager')])\r\n LogicalProject(NAME=[$0], EMPNO=[$2], JOB=[$3])\r\n LogicalJoin(condition=[=($1, $4)], joinType=[inner])\r\n LogicalProject(NAME=[$1], DEPTNO0=[CAST($0):INTEGER NOT NULL])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(EMPNO=[$0], JOB=[$1], DEPTNO0=[CAST($2):INTEGER NOT NULL])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[CAST($0):VARCHAR(128) NOT NULL], EXPR$1=[$1])\r\n LogicalFilter(condition=[=(CAST(CAST($2):VARCHAR(1) NOT NULL):VARCHAR(7) NOT NULL, 'Manager')])\r\n LogicalProject(NAME=[$0], EMPNO=[$2], JOB=[$3])\r\n LogicalJoin(condition=[=($1, $4)], joinType=[inner])\r\n LogicalProject(NAME=[$1], DEPTNO0=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceCompositeInSubQuery.json b/tests/RelOptRulesTest/testReduceCompositeInSubQuery.json deleted file mode 100644 index 181e6a2..0000000 --- a/tests/RelOptRulesTest/testReduceCompositeInSubQuery.json +++ /dev/null @@ -1,453 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "IN", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 11, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 10, - "type": "INTEGER" - }, - { - "column": 12, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 11, - "type": "INTEGER" - }, - { - "column": 18, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "40", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "60", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "IN", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 11, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 10, - "type": "INTEGER" - }, - { - "column": 12, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 11, - "type": "INTEGER" - }, - { - "column": 18, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[OR(IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$1])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n}), <($7, +(40, 60)))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[OR(IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$1])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n}), <($7, 100))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstants.json b/tests/RelOptRulesTest/testReduceConstants.json deleted file mode 100644 index 5de81bb..0000000 --- a/tests/RelOptRulesTest/testReduceConstants.json +++ /dev/null @@ -1,376 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "3", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "+", - "operand": [ - { - "operator": "5", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "6", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "ROW", - "operand": [ - { - "operator": "+", - "operand": [ - { - "operator": "7", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "8", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "ROW" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "7", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "8", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "-", - "operand": [ - { - "operator": "5", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "3", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "22", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "26", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "ROW", - "operand": [ - { - "operator": "15", - "operand": [], - "type": "INTEGER" - } - ], - "type": "ROW" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[+(1, 2)], EXPR$1=[+($0, +(3, 4))], EXPR$2=[+(+(5, 6), $0)], EXPR$3=[null:INTEGER], EXPR$4=[CASE(IS NOT NULL(2), 2, null:INTEGER)], EXPR$5=[ROW(+(7, 8))])\r\n LogicalFilter(condition=[AND(=($0, +(7, 8)), =($0, CASE(IS NOT NULL(2), 2, null:INTEGER)))])\r\n LogicalProject(DEPTNO=[$0])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject($f9=[+($0, -(5, 5))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[3], EXPR$1=[22], EXPR$2=[26], EXPR$3=[null:INTEGER], EXPR$4=[CAST(2):INTEGER], EXPR$5=[ROW(15)])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstants3.json b/tests/RelOptRulesTest/testReduceConstants3.json deleted file mode 100644 index d4dc151..0000000 --- a/tests/RelOptRulesTest/testReduceConstants3.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "MGR" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - true - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NULL", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NULL", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[OR(AND(IS NULL($0), IS NULL($1)), IS TRUE(=($0, $1)))])\r\n LogicalFilter(condition=[IS NULL($0)])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[IS NULL($1)])\r\n LogicalFilter(condition=[IS NULL($0)])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsCaseEquals.json b/tests/RelOptRulesTest/testReduceConstantsCaseEquals.json deleted file mode 100644 index 1accb2c..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsCaseEquals.json +++ /dev/null @@ -1,272 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\r\n LogicalFilter(condition=[=(CASE(=($0, 20), 2, =($0, 10), 1, 3), 1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\r\n LogicalFilter(condition=[=($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsCaseEquals2.json b/tests/RelOptRulesTest/testReduceConstantsCaseEquals2.json deleted file mode 100644 index 3af085a..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsCaseEquals2.json +++ /dev/null @@ -1,272 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\r\n LogicalFilter(condition=[=(CASE(=($0, 20), 2, =($0, 10), 1, null:INTEGER), 1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\r\n LogicalFilter(condition=[=($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsCaseEquals3.json b/tests/RelOptRulesTest/testReduceConstantsCaseEquals3.json deleted file mode 100644 index 8960d75..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsCaseEquals3.json +++ /dev/null @@ -1,352 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "111", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "30", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "111", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "filter": { - "condition": { - "operator": "SEARCH", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "Sarg[10, 30]", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "SEARCH", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "Sarg[10, 30]", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\r\n LogicalFilter(condition=[=(CASE(=($0, 30), 1, =($0, 20), 2, =($0, 10), 1, =($0, 30), 111, 0), 1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\r\n LogicalFilter(condition=[SEARCH($0, Sarg[10, 30])])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsDup.json b/tests/RelOptRulesTest/testReduceConstantsDup.json deleted file mode 100644 index a26a43c..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsDup.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "8", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalFilter(condition=[AND(=($0, 7), =($0, 8))])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(DEPTNO=[$0])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsDup2.json b/tests/RelOptRulesTest/testReduceConstantsDup2.json deleted file mode 100644 index 5f025c9..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsDup2.json +++ /dev/null @@ -1,237 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "8", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[AND(=($7, 7), =($7, 8), =($0, 10), IS NULL($3), =($0, 10))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[10], ENAME=[$1], JOB=[$2], MGR=[null:INTEGER], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsDup3.json b/tests/RelOptRulesTest/testReduceConstantsDup3.json deleted file mode 100644 index 4509ba2..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsDup3.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "<>", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "8", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "scan": 0 - } - ], - "help": [ - "LogicalFilter(condition=[OR(<>($0, 7), <>($0, 8))])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsDup3Null.json b/tests/RelOptRulesTest/testReduceConstantsDup3Null.json deleted file mode 100644 index 302c3ff..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsDup3Null.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "MGR" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - true - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "<>", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "8", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[OR(<>($1, 7), <>($1, 8))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[IS NOT NULL($1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsDupNot.json b/tests/RelOptRulesTest/testReduceConstantsDupNot.json deleted file mode 100644 index db4fe86..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsDupNot.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "NOT", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "8", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "scan": 0 - } - ], - "help": [ - "LogicalFilter(condition=[NOT(AND(=($0, 7), =($0, 8)))])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsDupNot2.json b/tests/RelOptRulesTest/testReduceConstantsDupNot2.json deleted file mode 100644 index 361f686..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsDupNot2.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "NOT", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'foo'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "8", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0])\r\n LogicalFilter(condition=[NOT(AND(=($0, 7), =($1, 'foo'), =($0, 8)))])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsDupNot2Null.json b/tests/RelOptRulesTest/testReduceConstantsDupNot2Null.json deleted file mode 100644 index 9b40cf4..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsDupNot2Null.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "MGR", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - true, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "NOT", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "8", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "8", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "8", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[NOT(AND(=($1, 7), =($2, 8), =($1, 8)))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[OR(IS NOT NULL($1), <>($2, 8))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsDupNotNull.json b/tests/RelOptRulesTest/testReduceConstantsDupNotNull.json deleted file mode 100644 index fc92ac3..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsDupNotNull.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "MGR" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - true - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "NOT", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "8", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[NOT(AND(=($1, 7), =($1, 8)))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[IS NOT NULL($1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsEliminatesFilter.json b/tests/RelOptRulesTest/testReduceConstantsEliminatesFilter.json deleted file mode 100644 index c5ed813..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsEliminatesFilter.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "operator": "+", - "operand": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "3", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\r\n LogicalFilter(condition=[>(+(1, 2), +(3, null))])\r\n LogicalValues(tuples=[[{ 1, 2 }]])\r\n", - "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsIsNotNull.json b/tests/RelOptRulesTest/testReduceConstantsIsNotNull.json deleted file mode 100644 index d350923..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsIsNotNull.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - ], - "help": [ - "LogicalFilter(condition=[=($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalFilter(condition=[=($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsIsNull.json b/tests/RelOptRulesTest/testReduceConstantsIsNull.json deleted file mode 100644 index d30018b..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsIsNull.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "values": { - "schema": [ - "INTEGER" - ], - "content": [] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalValues(tuples=[[]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsNegated.json b/tests/RelOptRulesTest/testReduceConstantsNegated.json deleted file mode 100644 index c0c8695..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsNegated.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NOT", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalFilter(condition=[AND(=($0, 10), NOT(=($0, 10)))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsNegatedInverted.json b/tests/RelOptRulesTest/testReduceConstantsNegatedInverted.json deleted file mode 100644 index 03c1626..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsNegatedInverted.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalFilter(condition=[AND(>($0, 10), <=($0, 10))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsNull.json b/tests/RelOptRulesTest/testReduceConstantsNull.json deleted file mode 100644 index 6a9d3e9..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsNull.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "IS NULL", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "IS NULL", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalFilter(condition=[IS NULL($0)])\r\n LogicalFilter(condition=[IS NULL($0)])\r\n LogicalProject(N=[null:INTEGER])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(N=[null:INTEGER])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsNullEqualsOne.json b/tests/RelOptRulesTest/testReduceConstantsNullEqualsOne.json deleted file mode 100644 index d91e7b8..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsNullEqualsOne.json +++ /dev/null @@ -1,218 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "content": [] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "content": [] - } - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\r\n LogicalFilter(condition=[=(null, 1)])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsProjectNullable.json b/tests/RelOptRulesTest/testReduceConstantsProjectNullable.json deleted file mode 100644 index e9ed024..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsProjectNullable.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "MGR" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - true - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "operator": "CAST", - "operand": [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalFilter(condition=[=($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(MGR=[CAST(10):INTEGER])\r\n LogicalFilter(condition=[=($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceConstantsRequiresExecutor.json b/tests/RelOptRulesTest/testReduceConstantsRequiresExecutor.json deleted file mode 100644 index c5ed813..0000000 --- a/tests/RelOptRulesTest/testReduceConstantsRequiresExecutor.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "operator": "+", - "operand": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "3", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\r\n LogicalFilter(condition=[>(+(1, 2), +(3, null))])\r\n LogicalValues(tuples=[[{ 1, 2 }]])\r\n", - "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceDynamic.json b/tests/RelOptRulesTest/testReduceDynamic.json deleted file mode 100644 index 16eaf26..0000000 --- a/tests/RelOptRulesTest/testReduceDynamic.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "USER", - "operand": [], - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "_ISO-8859-1'happyCalciteUser'", - "operand": [], - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(USER=[USER])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(USER=['happyCalciteUser':VARCHAR(2000)])\r\n LogicalProject(DUMMY=[0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceNestedCaseWhen.json b/tests/RelOptRulesTest/testReduceNestedCaseWhen.json deleted file mode 100644 index 1758db5..0000000 --- a/tests/RelOptRulesTest/testReduceNestedCaseWhen.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "IS TRUE", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "2000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "filter": { - "condition": { - "operator": "SEARCH", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "Sarg[1000, 2000]", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - ], - "help": [ - "LogicalFilter(condition=[IS TRUE(CASE(=($0, 1000), IS NULL(CASE(=($0, 1000), null:INTEGER, 1)), IS NULL(CASE(=($0, 2000), null:INTEGER, 1))))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalFilter(condition=[SEARCH($0, Sarg[1000, 2000])])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceNullableToNotNull.json b/tests/RelOptRulesTest/testReduceNullableToNotNull.json deleted file mode 100644 index 726a281..0000000 --- a/tests/RelOptRulesTest/testReduceNullableToNotNull.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "operator": "_ISO-8859-1'a'", - "operand": [], - "type": "CHAR" - }, - { - "operator": "_ISO-8859-1'a'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ], - "help": [ - "LogicalProject(NEWCOL=[+($0, CASE(=('a', 'a'), 1, null:INTEGER))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(NEWCOL=[+($0, 1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceNullableToNotNull2.json b/tests/RelOptRulesTest/testReduceNullableToNotNull2.json deleted file mode 100644 index 726a281..0000000 --- a/tests/RelOptRulesTest/testReduceNullableToNotNull2.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "operator": "_ISO-8859-1'a'", - "operand": [], - "type": "CHAR" - }, - { - "operator": "_ISO-8859-1'a'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ], - "help": [ - "LogicalProject(NEWCOL=[+($0, CASE(=('a', 'a'), 1, null:INTEGER))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(NEWCOL=[+($0, 1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceOrCaseWhen.json b/tests/RelOptRulesTest/testReduceOrCaseWhen.json deleted file mode 100644 index 0d8a75a..0000000 --- a/tests/RelOptRulesTest/testReduceOrCaseWhen.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "2000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "filter": { - "condition": { - "operator": "SEARCH", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "Sarg[1000, 2000]", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - ], - "help": [ - "LogicalFilter(condition=[OR(IS NULL(CASE(=($0, 1000), null:INTEGER, 1)), IS NULL(CASE(=($0, 2000), null:INTEGER, 1)))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalFilter(condition=[SEARCH($0, Sarg[1000, 2000])])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceValuesToEmpty.json b/tests/RelOptRulesTest/testReduceValuesToEmpty.json deleted file mode 100644 index 80a534d..0000000 --- a/tests/RelOptRulesTest/testReduceValuesToEmpty.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "operator": "-", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - [ - { - "operator": "30", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - } - } - }, - { - "values": { - "schema": [ - "INTEGER", - "INTEGER", - "INTEGER" - ], - "content": [] - } - } - ], - "help": [ - "LogicalProject(X=[+($0, $1)], B=[$1], A=[$0])\r\n LogicalFilter(condition=[<(-($0, $1), 0)])\r\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 7 }]])\r\n", - "LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceValuesUnderFilter.json b/tests/RelOptRulesTest/testReduceValuesUnderFilter.json deleted file mode 100644 index a536091..0000000 --- a/tests/RelOptRulesTest/testReduceValuesUnderFilter.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "CHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "15", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "values": { - "schema": [ - "INTEGER", - "CHAR" - ], - "content": [ - [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "_ISO-8859-1'x'", - "operand": [], - "type": "CHAR" - } - ], - [ - { - "operator": "20", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "_ISO-8859-1'y'", - "operand": [], - "type": "CHAR" - } - ] - ] - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "CHAR" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "CHAR" - ], - "content": [ - [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "_ISO-8859-1'x'", - "operand": [], - "type": "CHAR" - } - ] - ] - } - } - } - } - ], - "help": [ - "LogicalProject(A=[$0], B=[$1])\r\n LogicalFilter(condition=[<($0, 15)])\r\n LogicalValues(tuples=[[{ 10, 'x' }, { 20, 'y' }]])\r\n", - "LogicalProject(A=[$0], B=[$1])\r\n LogicalValues(tuples=[[{ 10, 'x' }]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceValuesUnderProject.json b/tests/RelOptRulesTest/testReduceValuesUnderProject.json deleted file mode 100644 index 85e02c4..0000000 --- a/tests/RelOptRulesTest/testReduceValuesUnderProject.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - [ - { - "operator": "20", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - }, - { - "values": { - "schema": [ - "INTEGER" - ], - "content": [ - [ - { - "operator": "11", - "operand": [], - "type": "INTEGER" - } - ], - [ - { - "operator": "23", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[+($0, $1)])\r\n LogicalValues(tuples=[[{ 10, 1 }, { 20, 3 }]])\r\n", - "LogicalValues(tuples=[[{ 11 }, { 23 }]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceValuesUnderProjectFilter.json b/tests/RelOptRulesTest/testReduceValuesUnderProjectFilter.json deleted file mode 100644 index 8aa9172..0000000 --- a/tests/RelOptRulesTest/testReduceValuesUnderProjectFilter.json +++ /dev/null @@ -1,157 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "project": { - "target": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "operator": "-", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "21", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "values": { - "schema": [ - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - [ - { - "operator": "30", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - [ - { - "operator": "20", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - } - } - } - }, - { - "values": { - "schema": [ - "INTEGER", - "INTEGER", - "INTEGER" - ], - "content": [ - [ - { - "operator": "11", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - [ - { - "operator": "23", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ] - ] - } - } - ], - "help": [ - "LogicalProject(X=[+($0, $1)], B=[$1], A=[$0])\r\n LogicalFilter(condition=[<(-($0, $1), 21)])\r\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 7 }, { 20, 3 }]])\r\n", - "LogicalValues(tuples=[[{ 11, 1, 10 }, { 23, 3, 20 }]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testReduceWithNonTypePredicate.json b/tests/RelOptRulesTest/testReduceWithNonTypePredicate.json deleted file mode 100644 index 488337e..0000000 --- a/tests/RelOptRulesTest/testReduceWithNonTypePredicate.json +++ /dev/null @@ -1,220 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "AVG", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "AVG", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "/", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 2, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "AVG", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "$SUM0", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[AVG($0)], EXPR$1=[AVG($0) WITHIN DISTINCT ($1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[$0], EXPR$1=[CAST(/($1, $2)):INTEGER])\r\n LogicalProject(EXPR$0=[$0], $f1=[CASE(=($2, 0), null:INTEGER, $1)], $f2=[$2])\r\n LogicalAggregate(group=[{}], EXPR$0=[AVG($0)], agg#1=[$SUM0($0) WITHIN DISTINCT ($1)], agg#2=[COUNT() WITHIN DISTINCT ($1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testRemoveDistinctOnAgg.json b/tests/RelOptRulesTest/testRemoveDistinctOnAgg.json deleted file mode 100644 index 6087899..0000000 --- a/tests/RelOptRulesTest/testRemoveDistinctOnAgg.json +++ /dev/null @@ -1,306 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "BIT_AND", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "BIT_OR", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "BIGINT" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], EXPR$1=[$2], EXPR$2=[$3], EXPR$3=[$3], EXPR$4=[$4], EXPR$5=[$5], EXPR$6=[$6], EXPR$7=[$7])\r\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM(DISTINCT $2)], EXPR$2=[MIN($2)], EXPR$4=[MAX($2)], EXPR$5=[BIT_AND($2)], EXPR$6=[BIT_OR($2)], EXPR$7=[COUNT(DISTINCT $2)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$2], SAL=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], EXPR$1=[$1], EXPR$2=[$1], EXPR$3=[$1], EXPR$4=[$1], EXPR$5=[$1], EXPR$6=[$1], EXPR$7=[1:BIGINT])\r\n LogicalProject(EMPNO=[$0], SAL=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testRemoveSemiJoin.json b/tests/RelOptRulesTest/testRemoveSemiJoin.json deleted file mode 100644 index ad1ec11..0000000 --- a/tests/RelOptRulesTest/testRemoveSemiJoin.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalProject(ENAME=[$0])\r\n LogicalFilter(condition=[=($1, $2)])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(ENAME=[$0])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testRemoveSemiJoinRight.json b/tests/RelOptRulesTest/testRemoveSemiJoinRight.json deleted file mode 100644 index 9da695d..0000000 --- a/tests/RelOptRulesTest/testRemoveSemiJoinRight.json +++ /dev/null @@ -1,199 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(ENAME=[$0])\r\n LogicalFilter(condition=[AND(=($1, $2), =($2, $3))])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(ENAME=[$0])\r\n LogicalJoin(condition=[=($2, $3)], joinType=[inner])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testRemoveSemiJoinRightWithFilter.json b/tests/RelOptRulesTest/testRemoveSemiJoinRightWithFilter.json deleted file mode 100644 index 013b035..0000000 --- a/tests/RelOptRulesTest/testRemoveSemiJoinRightWithFilter.json +++ /dev/null @@ -1,236 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'foo'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'foo'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(ENAME=[$0])\r\n LogicalFilter(condition=[AND(=($1, $2), =($2, $4), =($3, 'foo'))])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(ENAME=[$0])\r\n LogicalJoin(condition=[=($2, $4)], joinType=[inner])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[=($1, 'foo')])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testRemoveSemiJoinWithFilter.json b/tests/RelOptRulesTest/testRemoveSemiJoinWithFilter.json deleted file mode 100644 index 644690f..0000000 --- a/tests/RelOptRulesTest/testRemoveSemiJoinWithFilter.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'foo'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'foo'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalProject(ENAME=[$0])\r\n LogicalFilter(condition=[AND(=($1, $2), =($0, 'foo'))])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(ENAME=[$0])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\r\n LogicalFilter(condition=[=($0, 'foo')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testRightEmptyAntiJoin.json b/tests/RelOptRulesTest/testRightEmptyAntiJoin.json deleted file mode 100644 index 96d9f86..0000000 --- a/tests/RelOptRulesTest/testRightEmptyAntiJoin.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "DEPTNO" - ], - "types": [ - "SMALLINT", - "TINYINT" - ], - "nullable": [ - false, - true - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "SMALLINT" - } - ], - "source": { - "join": { - "kind": "ANTI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "TINYINT" - }, - { - "column": 2, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "values": { - "schema": [ - "TINYINT", - "VARCHAR", - "VARCHAR" - ], - "content": [] - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "SMALLINT" - } - ], - "source": { - "scan": 0 - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[anti])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n LogicalValues(tuples=[[]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testRightEmptyAntiJoinNonEqui.json b/tests/RelOptRulesTest/testRightEmptyAntiJoinNonEqui.json deleted file mode 100644 index e054b55..0000000 --- a/tests/RelOptRulesTest/testRightEmptyAntiJoinNonEqui.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "SAL", - "DEPTNO" - ], - "types": [ - "SMALLINT", - "DECIMAL", - "TINYINT" - ], - "nullable": [ - false, - true, - true - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "SMALLINT" - } - ], - "source": { - "join": { - "kind": "ANTI", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "TINYINT" - }, - { - "column": 3, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "DECIMAL" - }, - { - "operator": "2000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "values": { - "schema": [ - "TINYINT", - "VARCHAR", - "VARCHAR" - ], - "content": [] - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "SMALLINT" - } - ], - "source": { - "scan": 0 - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalJoin(condition=[AND(=($2, $3), =($1, 2000))], joinType=[anti])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n LogicalValues(tuples=[[]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testRightEmptyFullJoin.json b/tests/RelOptRulesTest/testRightEmptyFullJoin.json deleted file mode 100644 index 68cd02e..0000000 --- a/tests/RelOptRulesTest/testRightEmptyFullJoin.json +++ /dev/null @@ -1,252 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "FULL", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR" - ], - "content": [] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DEPTNO=[$0], NAME=[$1])\r\n LogicalFilter(condition=[false])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testRightEmptyInnerJoin.json b/tests/RelOptRulesTest/testRightEmptyInnerJoin.json deleted file mode 100644 index 79d9d50..0000000 --- a/tests/RelOptRulesTest/testRightEmptyInnerJoin.json +++ /dev/null @@ -1,239 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN", - "INTEGER", - "VARCHAR" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DEPTNO=[$0], NAME=[$1])\r\n LogicalFilter(condition=[false])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testRightEmptyLeftJoin.json b/tests/RelOptRulesTest/testRightEmptyLeftJoin.json deleted file mode 100644 index cb6a659..0000000 --- a/tests/RelOptRulesTest/testRightEmptyLeftJoin.json +++ /dev/null @@ -1,252 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR" - ], - "content": [] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DEPTNO=[$0], NAME=[$1])\r\n LogicalFilter(condition=[false])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testRightEmptyRightJoin.json b/tests/RelOptRulesTest/testRightEmptyRightJoin.json deleted file mode 100644 index 4757057..0000000 --- a/tests/RelOptRulesTest/testRightEmptyRightJoin.json +++ /dev/null @@ -1,239 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "false", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "values": { - "schema": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN", - "INTEGER", - "VARCHAR" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DEPTNO=[$0], NAME=[$1])\r\n LogicalFilter(condition=[false])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testRightEmptySemiJoin.json b/tests/RelOptRulesTest/testRightEmptySemiJoin.json deleted file mode 100644 index fecee47..0000000 --- a/tests/RelOptRulesTest/testRightEmptySemiJoin.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "DEPTNO" - ], - "types": [ - "SMALLINT", - "TINYINT" - ], - "nullable": [ - false, - true - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "SMALLINT" - } - ], - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "TINYINT" - }, - { - "column": 2, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "values": { - "schema": [ - "TINYINT", - "VARCHAR", - "VARCHAR" - ], - "content": [] - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "SMALLINT" - } - ], - "source": { - "values": { - "schema": [ - "SMALLINT", - "VARCHAR", - "VARCHAR", - "SMALLINT", - "DATE", - "DECIMAL", - "DECIMAL", - "TINYINT" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n LogicalValues(tuples=[[]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testRightOuterJoinSimplificationToInner.json b/tests/RelOptRulesTest/testRightOuterJoinSimplificationToInner.json deleted file mode 100644 index 730a0a9..0000000 --- a/tests/RelOptRulesTest/testRightOuterJoinSimplificationToInner.json +++ /dev/null @@ -1,166 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'Charlie'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'Charlie'", - "operand": [], - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalFilter(condition=[=($1, 'Charlie')])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalProject(DUMMY=[0])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalFilter(condition=[=($1, 'Charlie')])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSemiJoinProjectTranspose.json b/tests/RelOptRulesTest/testSemiJoinProjectTranspose.json deleted file mode 100644 index e3ce899..0000000 --- a/tests/RelOptRulesTest/testSemiJoinProjectTranspose.json +++ /dev/null @@ -1,348 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "DNAME" - ], - "types": [ - "TINYINT", - "VARCHAR" - ], - "nullable": [ - false, - true - ], - "key": [ - [ - 0 - ], - [ - 1 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "DNAME" - ], - "types": [ - "TINYINT", - "VARCHAR" - ], - "nullable": [ - false, - true - ], - "key": [ - [ - 0 - ], - [ - 1 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "TINYINT" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "*", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "column": 0, - "type": "TINYINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "TINYINT" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "*", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "TINYINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "TINYINT" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "TINYINT" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "*", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "column": 0, - "type": "TINYINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "TINYINT" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "*", - "operand": [ - { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "TINYINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "TINYINT" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(DNAME=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject($f0=[*(2, $0)])\r\n LogicalProject(DEPTNO=[$0])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n", - "LogicalProject(DNAME=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject($f0=[*(2, $0)])\r\n LogicalProject(DEPTNO=[$0])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSemiJoinReduceConstants.json b/tests/RelOptRulesTest/testSemiJoinReduceConstants.json deleted file mode 100644 index ce9437e..0000000 --- a/tests/RelOptRulesTest/testSemiJoinReduceConstants.json +++ /dev/null @@ -1,194 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "200", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "operator": "200", - "operand": [], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "200", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(SAL=[$0])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\r\n LogicalFilter(condition=[=($1, 200)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalFilter(condition=[=($0, 100)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(SAL=[$0])\r\n LogicalJoin(condition=[=(200, $2)], joinType=[semi])\r\n LogicalFilter(condition=[=($1, 200)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalFilter(condition=[=($0, 100)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSemiJoinRule.json b/tests/RelOptRulesTest/testSemiJoinRule.json deleted file mode 100644 index 40ffa63..0000000 --- a/tests/RelOptRulesTest/testSemiJoinRule.json +++ /dev/null @@ -1,247 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0], NAME=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalFilter(condition=[>($0, 100)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalJoin(condition=[=($0, $2)], joinType=[semi])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalFilter(condition=[>($0, 100)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSemiJoinRuleExists.json b/tests/RelOptRulesTest/testSemiJoinRuleExists.json deleted file mode 100644 index 40ffa63..0000000 --- a/tests/RelOptRulesTest/testSemiJoinRuleExists.json +++ /dev/null @@ -1,247 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0], NAME=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalFilter(condition=[>($0, 100)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalJoin(condition=[=($0, $2)], joinType=[semi])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalFilter(condition=[>($0, 100)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSemiJoinRuleLeft.json b/tests/RelOptRulesTest/testSemiJoinRuleLeft.json deleted file mode 100644 index 6682a51..0000000 --- a/tests/RelOptRulesTest/testSemiJoinRuleLeft.json +++ /dev/null @@ -1,202 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - ], - "help": [ - "LogicalProject(NAME=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalFilter(condition=[>($0, 100)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(NAME=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSemiJoinRuleWithHint.json b/tests/RelOptRulesTest/testSemiJoinRuleWithHint.json deleted file mode 100644 index 7b8052e..0000000 --- a/tests/RelOptRulesTest/testSemiJoinRuleWithHint.json +++ /dev/null @@ -1,203 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "DNAME" - ], - "types": [ - "TINYINT", - "VARCHAR" - ], - "nullable": [ - false, - true - ], - "key": [ - [ - 0 - ], - [ - 1 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "EMPNO", - "DEPTNO" - ], - "types": [ - "SMALLINT", - "TINYINT" - ], - "nullable": [ - false, - true - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "TINYINT" - }, - { - "column": 2, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "TINYINT" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "TINYINT" - } - ], - "source": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "TINYINT" - }, - { - "column": 1, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "TINYINT" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "TINYINT" - }, - { - "column": 2, - "type": "TINYINT" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "TINYINT" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(DNAME=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n", - "LogicalProject(DNAME=[$1])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\r\n LogicalTableScan(table=[[scott, DEPT]])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalTableScan(table=[[scott, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSemiJoinRuleWithJoinOnUniqueInput.json b/tests/RelOptRulesTest/testSemiJoinRuleWithJoinOnUniqueInput.json deleted file mode 100644 index 8dffe28..0000000 --- a/tests/RelOptRulesTest/testSemiJoinRuleWithJoinOnUniqueInput.json +++ /dev/null @@ -1,162 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalJoin(condition=[=($7, $9)], joinType=[semi])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSemiJoinTrim.json b/tests/RelOptRulesTest/testSemiJoinTrim.json deleted file mode 100644 index 07f53e3..0000000 --- a/tests/RelOptRulesTest/testSemiJoinTrim.json +++ /dev/null @@ -1,231 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - }, - { - "name": "ACCOUNT", - "fields": [ - "ACCTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - }, - "right": { - "scan": 2 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - }, - "right": { - "scan": 2 - } - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[semi])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalFilter(condition=[>($0, 100)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, CUSTOMER, ACCOUNT]])\r\n", - "LogicalProject(DEPTNO=[$0])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[semi])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalFilter(condition=[>($0, 100)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, CUSTOMER, ACCOUNT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSimplifyFilter.json b/tests/RelOptRulesTest/testSimplifyFilter.json deleted file mode 100644 index 6f4251a..0000000 --- a/tests/RelOptRulesTest/testSimplifyFilter.json +++ /dev/null @@ -1,323 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "5", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "3", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[AND(>($0, 3), >($7, 5))])\r\n LogicalFilter(condition=[>($7, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[>($0, 3)])\r\n LogicalFilter(condition=[>($7, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSkipReduceConstantsCaseEquals.json b/tests/RelOptRulesTest/testSkipReduceConstantsCaseEquals.json deleted file mode 100644 index 7754102..0000000 --- a/tests/RelOptRulesTest/testSkipReduceConstantsCaseEquals.json +++ /dev/null @@ -1,375 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - }, - { - "column": 11, - "type": "VARCHAR" - }, - { - "column": 12, - "type": "INTEGER" - }, - { - "column": 13, - "type": "TIMESTAMP" - }, - { - "column": 14, - "type": "INTEGER" - }, - { - "column": 15, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - }, - { - "column": 17, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 12, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 12, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - }, - { - "column": 11, - "type": "VARCHAR" - }, - { - "column": 12, - "type": "INTEGER" - }, - { - "column": 13, - "type": "TIMESTAMP" - }, - { - "column": 14, - "type": "INTEGER" - }, - { - "column": 15, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - }, - { - "column": 17, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "operator": "CASE", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 12, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 12, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "-1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\r\n LogicalFilter(condition=[=(CASE(IS NOT NULL($3), CAST($3):INTEGER NOT NULL, -1), CASE(IS NOT NULL($12), CAST($12):INTEGER NOT NULL, -1))])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\r\n LogicalJoin(condition=[=(CASE(IS NOT NULL($3), CAST($3):INTEGER NOT NULL, -1), CASE(IS NOT NULL($12), CAST($12):INTEGER NOT NULL, -1))], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSome.json b/tests/RelOptRulesTest/testSome.json deleted file mode 100644 index bb84a4f..0000000 --- a/tests/RelOptRulesTest/testSome.json +++ /dev/null @@ -1,436 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "> SOME", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "query": { - "scan": 1 - }, - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "IS TRUE", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "column": 11, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT TRUE", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT TRUE", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<=", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "column": 11, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 1, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[> SOME($0, {\nLogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n})])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[OR(AND(IS TRUE(>($0, $9)), <>($10, 0)), AND(>($10, $11), null, <>($10, 0), IS NOT TRUE(>($0, $9))), AND(>($0, $9), <>($10, 0), IS NOT TRUE(>($0, $9)), <=($10, $11)))])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(m=[$0], c=[$1], d=[$1])\r\n LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSomeWithEquality.json b/tests/RelOptRulesTest/testSomeWithEquality.json deleted file mode 100644 index b47d44b..0000000 --- a/tests/RelOptRulesTest/testSomeWithEquality.json +++ /dev/null @@ -1,199 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IN", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "query": { - "scan": 1 - }, - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[IN($7, {\nLogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n})])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSomeWithEquality2.json b/tests/RelOptRulesTest/testSomeWithEquality2.json deleted file mode 100644 index 5402fbc..0000000 --- a/tests/RelOptRulesTest/testSomeWithEquality2.json +++ /dev/null @@ -1,243 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "NAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IN", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "query": { - "scan": 1 - }, - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 9, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[IN($1, {\nLogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n})])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalJoin(condition=[=($1, $9)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSomeWithNotEquality.json b/tests/RelOptRulesTest/testSomeWithNotEquality.json deleted file mode 100644 index fdab2f9..0000000 --- a/tests/RelOptRulesTest/testSomeWithNotEquality.json +++ /dev/null @@ -1,497 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "<> SOME", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "query": { - "scan": 1 - }, - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "<>", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "column": 9, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<=", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "OR", - "operand": [ - { - "operator": "<>", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 11, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 11, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "OR", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "column": 9, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "<>", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "OR", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "column": 9, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<>", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "BIGINT" - }, - { - "column": 0, - "type": "BIGINT" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 1 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[<> SOME($7, {\nLogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n})])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[OR(AND(<>($10, $9), <=($10, 1), OR(<>($7, $11), null), <>($9, 0)), AND(=($10, 1), <>($7, $11), <>($9, 0), OR(=($10, $9), >($10, 1))), AND(<>($9, 0), OR(=($10, $9), >($10, 1)), <>($10, 1)))])\r\n LogicalJoin(condition=[true], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(c=[$0], d=[$0], m=[$1])\r\n LogicalAggregate(group=[{}], c=[COUNT()], m=[MAX($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSortJoinCopyInnerJoinOrderBy.json b/tests/RelOptRulesTest/testSortJoinCopyInnerJoinOrderBy.json deleted file mode 100644 index 14a3c54..0000000 --- a/tests/RelOptRulesTest/testSortJoinCopyInnerJoinOrderBy.json +++ /dev/null @@ -1,256 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "sort": { - "collation": [ - [ - 5, - "INTEGER", - "ASC" - ] - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "sort": { - "collation": [ - [ - 5, - "INTEGER", - "ASC" - ] - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "sort": { - "collation": [ - [ - 5, - "INTEGER", - "ASC" - ] - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalSort(sort0=[$5], dir0=[ASC])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalSort(sort0=[$5], dir0=[ASC])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\r\n LogicalSort(sort0=[$5], dir0=[ASC])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSortJoinCopyInnerJoinOrderByLimit.json b/tests/RelOptRulesTest/testSortJoinCopyInnerJoinOrderByLimit.json deleted file mode 100644 index d8942a0..0000000 --- a/tests/RelOptRulesTest/testSortJoinCopyInnerJoinOrderByLimit.json +++ /dev/null @@ -1,266 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "sort": { - "collation": [ - [ - 5, - "INTEGER", - "ASC" - ] - ], - "limit": { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "sort": { - "collation": [ - [ - 5, - "INTEGER", - "ASC" - ] - ], - "limit": { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "sort": { - "collation": [ - [ - 5, - "INTEGER", - "ASC" - ] - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\r\n LogicalSort(sort0=[$5], dir0=[ASC])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSortJoinCopyInnerJoinOrderByTwoFields.json b/tests/RelOptRulesTest/testSortJoinCopyInnerJoinOrderByTwoFields.json deleted file mode 100644 index 1e4a0c4..0000000 --- a/tests/RelOptRulesTest/testSortJoinCopyInnerJoinOrderByTwoFields.json +++ /dev/null @@ -1,277 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "sort": { - "collation": [ - [ - 5, - "INTEGER", - "ASC" - ], - [ - 10, - "VARCHAR", - "ASC" - ] - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "sort": { - "collation": [ - [ - 5, - "INTEGER", - "ASC" - ], - [ - 10, - "VARCHAR", - "ASC" - ] - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "sort": { - "collation": [ - [ - 5, - "INTEGER", - "ASC" - ] - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "sort": { - "collation": [ - [ - 1, - "VARCHAR", - "ASC" - ] - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalSort(sort0=[$5], sort1=[$10], dir0=[ASC], dir1=[ASC])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalSort(sort0=[$5], sort1=[$10], dir0=[ASC], dir1=[ASC])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\r\n LogicalSort(sort0=[$5], dir0=[ASC])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalSort(sort0=[$1], dir0=[ASC])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSortJoinCopySemiJoinOrderBy.json b/tests/RelOptRulesTest/testSortJoinCopySemiJoinOrderBy.json deleted file mode 100644 index 23fca22..0000000 --- a/tests/RelOptRulesTest/testSortJoinCopySemiJoinOrderBy.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "sort": { - "collation": [ - [ - 0, - "INTEGER", - "ASC" - ] - ], - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "sort": { - "collation": [ - [ - 0, - "INTEGER", - "ASC" - ] - ], - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "sort": { - "collation": [ - [ - 0, - "INTEGER", - "ASC" - ] - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalSort(sort0=[$0], dir0=[ASC])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalSort(sort0=[$0], dir0=[ASC])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\r\n LogicalSort(sort0=[$0], dir0=[ASC])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSortJoinCopySemiJoinOrderByLimitOffset.json b/tests/RelOptRulesTest/testSortJoinCopySemiJoinOrderByLimitOffset.json deleted file mode 100644 index 2a86a9f..0000000 --- a/tests/RelOptRulesTest/testSortJoinCopySemiJoinOrderByLimitOffset.json +++ /dev/null @@ -1,148 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "sort": { - "collation": [ - [ - 0, - "INTEGER", - "ASC" - ] - ], - "offset": { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - "limit": { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "sort": { - "collation": [ - [ - 0, - "INTEGER", - "ASC" - ] - ], - "offset": { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - "limit": { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "sort": { - "collation": [ - [ - 0, - "INTEGER", - "ASC" - ] - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalSort(sort0=[$0], dir0=[ASC], offset=[2], fetch=[10])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalSort(sort0=[$0], dir0=[ASC], offset=[2], fetch=[10])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\r\n LogicalSort(sort0=[$0], dir0=[ASC])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSortJoinCopySemiJoinOrderByOffset.json b/tests/RelOptRulesTest/testSortJoinCopySemiJoinOrderByOffset.json deleted file mode 100644 index 9568fd4..0000000 --- a/tests/RelOptRulesTest/testSortJoinCopySemiJoinOrderByOffset.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "sort": { - "collation": [ - [ - 0, - "INTEGER", - "ASC" - ] - ], - "offset": { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "sort": { - "collation": [ - [ - 0, - "INTEGER", - "ASC" - ] - ], - "offset": { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - "source": { - "join": { - "kind": "SEMI", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "sort": { - "collation": [ - [ - 0, - "INTEGER", - "ASC" - ] - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalSort(sort0=[$0], dir0=[ASC], offset=[2])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalSort(sort0=[$0], dir0=[ASC], offset=[2])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\r\n LogicalSort(sort0=[$0], dir0=[ASC])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSortJoinTranspose1.json b/tests/RelOptRulesTest/testSortJoinTranspose1.json deleted file mode 100644 index a9bd126..0000000 --- a/tests/RelOptRulesTest/testSortJoinTranspose1.json +++ /dev/null @@ -1,271 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "sort": { - "collation": [ - [ - 5, - "INTEGER", - "ASC" - ] - ], - "limit": { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "sort": { - "collation": [ - [ - 5, - "INTEGER", - "ASC" - ] - ], - "limit": { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "sort": { - "collation": [ - [ - 5, - "INTEGER", - "ASC" - ] - ], - "limit": { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 1 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\r\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSortJoinTranspose2.json b/tests/RelOptRulesTest/testSortJoinTranspose2.json deleted file mode 100644 index f7f50a9..0000000 --- a/tests/RelOptRulesTest/testSortJoinTranspose2.json +++ /dev/null @@ -1,256 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "sort": { - "collation": [ - [ - 10, - "VARCHAR", - "ASC" - ] - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "sort": { - "collation": [ - [ - 10, - "VARCHAR", - "ASC" - ] - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "sort": { - "collation": [ - [ - 1, - "VARCHAR", - "ASC" - ] - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalSort(sort0=[$10], dir0=[ASC])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalSort(sort0=[$10], dir0=[ASC])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalSort(sort0=[$1], dir0=[ASC])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSortJoinTranspose4.json b/tests/RelOptRulesTest/testSortJoinTranspose4.json deleted file mode 100644 index f7f50a9..0000000 --- a/tests/RelOptRulesTest/testSortJoinTranspose4.json +++ /dev/null @@ -1,256 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "sort": { - "collation": [ - [ - 10, - "VARCHAR", - "ASC" - ] - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "source": { - "sort": { - "collation": [ - [ - 10, - "VARCHAR", - "ASC" - ] - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "sort": { - "collation": [ - [ - 1, - "VARCHAR", - "ASC" - ] - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalSort(sort0=[$10], dir0=[ASC])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\r\n LogicalSort(sort0=[$10], dir0=[ASC])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalSort(sort0=[$1], dir0=[ASC])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSortJoinTranspose6.json b/tests/RelOptRulesTest/testSortJoinTranspose6.json deleted file mode 100644 index 8375b98..0000000 --- a/tests/RelOptRulesTest/testSortJoinTranspose6.json +++ /dev/null @@ -1,172 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "EMPNO", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "sort": { - "collation": [], - "offset": { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - "limit": { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "sort": { - "collation": [], - "offset": { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - "limit": { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "sort": { - "collation": [], - "offset": { - "operator": "2", - "operand": [], - "type": "INTEGER" - }, - "limit": { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0], EMPNO=[$1])\r\n LogicalSort(offset=[2], fetch=[10])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], EMPNO=[$1])\r\n LogicalSort(offset=[2], fetch=[10])\r\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalSort(offset=[2], fetch=[10])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSortProjectTranspose1.json b/tests/RelOptRulesTest/testSortProjectTranspose1.json deleted file mode 100644 index 0eb9b54..0000000 --- a/tests/RelOptRulesTest/testSortProjectTranspose1.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "sort": { - "collation": [ - [ - 1, - "INTEGER", - "ASC" - ] - ], - "offset": { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "sort": { - "collation": [ - [ - 0, - "INTEGER", - "ASC" - ] - ], - "offset": { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalSort(sort0=[$1], dir0=[ASC], offset=[1])\r\n LogicalProject(DEPTNO=[$0], EXPR$1=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(DEPTNO=[$0], EXPR$1=[$0])\r\n LogicalSort(sort0=[$0], dir0=[ASC], offset=[1])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSortProjectTranspose2.json b/tests/RelOptRulesTest/testSortProjectTranspose2.json deleted file mode 100644 index 0c2856b..0000000 --- a/tests/RelOptRulesTest/testSortProjectTranspose2.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "sort": { - "collation": [ - [ - 1, - "DOUBLE", - "ASC" - ] - ], - "offset": { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "DOUBLE" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "DOUBLE" - } - ], - "source": { - "sort": { - "collation": [ - [ - 0, - "INTEGER", - "ASC" - ] - ], - "offset": { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalSort(sort0=[$1], dir0=[ASC], offset=[1])\r\n LogicalProject(DEPTNO=[$0], EXPR$1=[CAST($0):DOUBLE NOT NULL])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(DEPTNO=[$0], EXPR$1=[CAST($0):DOUBLE NOT NULL])\r\n LogicalSort(sort0=[$0], dir0=[ASC], offset=[1])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSortRemovalAllKeysConstant.json b/tests/RelOptRulesTest/testSortRemovalAllKeysConstant.json deleted file mode 100644 index 57b2a12..0000000 --- a/tests/RelOptRulesTest/testSortRemovalAllKeysConstant.json +++ /dev/null @@ -1,352 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "sort": { - "collation": [ - [ - 1, - "INTEGER", - "DESC-nulls-last" - ] - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalSort(sort0=[$1], dir0=[DESC-nulls-last])\r\n LogicalProject(C=[$2], DEPTNO=[$0])\r\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\r\n LogicalProject(DEPTNO=[$1], SAL=[$0])\r\n LogicalFilter(condition=[=($1, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(C=[$2], DEPTNO=[$0])\r\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\r\n LogicalProject(DEPTNO=[$1], SAL=[$0])\r\n LogicalFilter(condition=[=($1, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSortRemovalOneKeyConstant.json b/tests/RelOptRulesTest/testSortRemovalOneKeyConstant.json deleted file mode 100644 index 06d5676..0000000 --- a/tests/RelOptRulesTest/testSortRemovalOneKeyConstant.json +++ /dev/null @@ -1,376 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "sort": { - "collation": [ - [ - 1, - "INTEGER", - "ASC" - ], - [ - 2, - "INTEGER", - "DESC" - ] - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "sort": { - "collation": [ - [ - 2, - "INTEGER", - "DESC" - ] - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalSort(sort0=[$1], sort1=[$2], dir0=[ASC], dir1=[DESC])\r\n LogicalProject(C=[$2], DEPTNO=[$0], SAL=[$1])\r\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\r\n LogicalProject(DEPTNO=[$1], SAL=[$0])\r\n LogicalFilter(condition=[=($1, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalSort(sort0=[$2], dir0=[DESC])\r\n LogicalProject(C=[$2], DEPTNO=[$0], SAL=[$1])\r\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\r\n LogicalProject(DEPTNO=[$1], SAL=[$0])\r\n LogicalFilter(condition=[=($1, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSortUnionTranspose.json b/tests/RelOptRulesTest/testSortUnionTranspose.json deleted file mode 100644 index eefe430..0000000 --- a/tests/RelOptRulesTest/testSortUnionTranspose.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "NAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "sort": { - "collation": [ - [ - 0, - "VARCHAR", - "ASC" - ] - ], - "limit": { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - }, - { - "sort": { - "collation": [ - [ - 0, - "VARCHAR", - "ASC" - ] - ], - "limit": { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - "source": { - "union": [ - { - "sort": { - "collation": [ - [ - 0, - "VARCHAR", - "ASC" - ] - ], - "limit": { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - "source": { - "scan": 0 - } - } - }, - { - "sort": { - "collation": [ - [ - 0, - "VARCHAR", - "ASC" - ] - ], - "limit": { - "operator": "10", - "operand": [], - "type": "INTEGER" - }, - "source": { - "scan": 0 - } - } - } - ] - } - } - } - ], - "help": [ - "LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\r\n LogicalUnion(all=[true])\r\n LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSortUnionTranspose2.json b/tests/RelOptRulesTest/testSortUnionTranspose2.json deleted file mode 100644 index 529d8bb..0000000 --- a/tests/RelOptRulesTest/testSortUnionTranspose2.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "NAME" - ], - "types": [ - "VARCHAR" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "sort": { - "collation": [ - [ - 0, - "VARCHAR", - "ASC" - ] - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - }, - { - "sort": { - "collation": [ - [ - 0, - "VARCHAR", - "ASC" - ] - ], - "source": { - "union": [ - { - "sort": { - "collation": [ - [ - 0, - "VARCHAR", - "ASC" - ] - ], - "source": { - "scan": 0 - } - } - }, - { - "sort": { - "collation": [ - [ - 0, - "VARCHAR", - "ASC" - ] - ], - "source": { - "scan": 0 - } - } - } - ] - } - } - } - ], - "help": [ - "LogicalSort(sort0=[$0], dir0=[ASC])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalSort(sort0=[$0], dir0=[ASC])\r\n LogicalUnion(all=[true])\r\n LogicalSort(sort0=[$0], dir0=[ASC])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalSort(sort0=[$0], dir0=[ASC])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSortUnionTranspose3.json b/tests/RelOptRulesTest/testSortUnionTranspose3.json deleted file mode 100644 index 782d853..0000000 --- a/tests/RelOptRulesTest/testSortUnionTranspose3.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "schemas": [], - "queries": [ - { - "values": { - "schema": [ - "VARCHAR" - ], - "content": [] - } - }, - { - "values": { - "schema": [ - "VARCHAR" - ], - "content": [] - } - } - ], - "help": [ - "LogicalValues(tuples=[[]])\r\n", - "LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSpatialContainsPoint.json b/tests/RelOptRulesTest/testSpatialContainsPoint.json deleted file mode 100644 index e4d08ff..0000000 --- a/tests/RelOptRulesTest/testSpatialContainsPoint.json +++ /dev/null @@ -1,199 +0,0 @@ -{ - "schemas": [ - { - "name": "RESTAURANTS", - "fields": [ - "NAME", - "LATITUDE", - "LONGITUDE", - "CUISINE", - "HILBERT" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER", - "VARCHAR", - "BIGINT" - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "ST_CONTAINS", - "operand": [ - { - "operator": "ST_BUFFER", - "operand": [ - { - "operator": "ST_POINT", - "operand": [ - { - "operator": "10.0", - "operand": [], - "type": "DECIMAL" - }, - { - "operator": "20.0", - "operand": [], - "type": "DECIMAL" - } - ], - "type": "GEOMETRY" - }, - { - "operator": "6", - "operand": [], - "type": "INTEGER" - } - ], - "type": "GEOMETRY" - }, - { - "operator": "ST_POINT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "GEOMETRY" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "SEARCH", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "ST_CONTAINS", - "operand": [ - { - "operator": "POLYGON ((16 20, 15.884711682419383 18.829458067903232, 15.54327719506772 17.703899405809462, 14.988817673815271 16.666578601882385, 14.242640687119286 15.757359312880716, 13.333421398117615 15.011182326184729, 12.29610059419054 14.45672280493228, 11.17054193209677 14.115288317580617, 10 14, 8.82945806790323 14.115288317580617, 7.703899405809461 14.45672280493228, 6.666578601882389 15.011182326184727, 5.757359312880715 15.757359312880714, 5.011182326184728 16.666578601882385, 4.45672280493228 17.70389940580946, 4.115288317580617 18.82945806790323, 4 20, 4.115288317580617 21.17054193209677, 4.456722804932279 22.296100594190538, 5.011182326184727 23.33342139811761, 5.757359312880714 24.242640687119284, 6.666578601882387 24.98881767381527, 7.703899405809458 25.54327719506772, 8.829458067903229 25.884711682419383, 9.999999999999998 26, 11.17054193209677 25.884711682419383, 12.29610059419054 25.54327719506772, 13.333421398117611 24.988817673815273, 14.242640687119284 24.242640687119284, 14.988817673815271 23.333421398117615, 15.54327719506772 22.29610059419054, 15.884711682419383 21.17054193209677, 16 20))", - "operand": [], - "type": "GEOMETRY" - }, - { - "operator": "ST_POINT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "GEOMETRY" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\r\n LogicalFilter(condition=[ST_CONTAINS(ST_BUFFER(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), 6), ST_POINT($2, $1))])\r\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\r\n", - "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\r\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]), ST_CONTAINS(POLYGON ((16 20, 15.884711682419383 18.829458067903232, 15.54327719506772 17.703899405809462, 14.988817673815271 16.666578601882385, 14.242640687119286 15.757359312880716, 13.333421398117615 15.011182326184729, 12.29610059419054 14.45672280493228, 11.17054193209677 14.115288317580617, 10 14, 8.82945806790323 14.115288317580617, 7.703899405809461 14.45672280493228, 6.666578601882389 15.011182326184727, 5.757359312880715 15.757359312880714, 5.011182326184728 16.666578601882385, 4.45672280493228 17.70389940580946, 4.115288317580617 18.82945806790323, 4 20, 4.115288317580617 21.17054193209677, 4.456722804932279 22.296100594190538, 5.011182326184727 23.33342139811761, 5.757359312880714 24.242640687119284, 6.666578601882387 24.98881767381527, 7.703899405809458 25.54327719506772, 8.829458067903229 25.884711682419383, 9.999999999999998 26, 11.17054193209677 25.884711682419383, 12.29610059419054 25.54327719506772, 13.333421398117611 24.988817673815273, 14.242640687119284 24.242640687119284, 14.988817673815271 23.333421398117615, 15.54327719506772 22.29610059419054, 15.884711682419383 21.17054193209677, 16 20)):GEOMETRY, ST_POINT($2, $1)))])\r\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSpatialDWithinLine.json b/tests/RelOptRulesTest/testSpatialDWithinLine.json deleted file mode 100644 index e162250..0000000 --- a/tests/RelOptRulesTest/testSpatialDWithinLine.json +++ /dev/null @@ -1,220 +0,0 @@ -{ - "schemas": [ - { - "name": "RESTAURANTS", - "fields": [ - "NAME", - "LATITUDE", - "LONGITUDE", - "CUISINE", - "HILBERT" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER", - "VARCHAR", - "BIGINT" - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "ST_DWITHIN", - "operand": [ - { - "operator": "ST_MAKELINE", - "operand": [ - { - "operator": "ST_POINT", - "operand": [ - { - "operator": "8.0", - "operand": [], - "type": "DECIMAL" - }, - { - "operator": "20.0", - "operand": [], - "type": "DECIMAL" - } - ], - "type": "GEOMETRY" - }, - { - "operator": "ST_POINT", - "operand": [ - { - "operator": "12.0", - "operand": [], - "type": "DECIMAL" - }, - { - "operator": "20.0", - "operand": [], - "type": "DECIMAL" - } - ], - "type": "GEOMETRY" - } - ], - "type": "GEOMETRY" - }, - { - "operator": "ST_POINT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "GEOMETRY" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "SEARCH", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "Sarg[[33064..33076], [33092..33100], [33112..33156], [33164..33176], [33236..33240], [36457..36459], [36501..36503], [36505..36507], [36517..36519]]", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "ST_DWITHIN", - "operand": [ - { - "operator": "LINESTRING (8 20, 12 20)", - "operand": [], - "type": "GEOMETRY" - }, - { - "operator": "ST_POINT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "GEOMETRY" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\r\n LogicalFilter(condition=[ST_DWITHIN(ST_MAKELINE(ST_POINT(8.0:DECIMAL(2, 1), 20.0:DECIMAL(3, 1)), ST_POINT(12.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1))), ST_POINT($2, $1), 4)])\r\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\r\n", - "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\r\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[33064..33076], [33092..33100], [33112..33156], [33164..33176], [33236..33240], [36457..36459], [36501..36503], [36505..36507], [36517..36519]]), ST_DWITHIN(LINESTRING (8 20, 12 20):GEOMETRY, ST_POINT($2, $1), 4))])\r\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSpatialDWithinReversed.json b/tests/RelOptRulesTest/testSpatialDWithinReversed.json deleted file mode 100644 index cb2654a..0000000 --- a/tests/RelOptRulesTest/testSpatialDWithinReversed.json +++ /dev/null @@ -1,198 +0,0 @@ -{ - "schemas": [ - { - "name": "RESTAURANTS", - "fields": [ - "NAME", - "LATITUDE", - "LONGITUDE", - "CUISINE", - "HILBERT" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER", - "VARCHAR", - "BIGINT" - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "ST_DWITHIN", - "operand": [ - { - "operator": "ST_POINT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "GEOMETRY" - }, - { - "operator": "ST_POINT", - "operand": [ - { - "operator": "10.0", - "operand": [], - "type": "DECIMAL" - }, - { - "operator": "20.0", - "operand": [], - "type": "DECIMAL" - } - ], - "type": "GEOMETRY" - }, - { - "operator": "6", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "SEARCH", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "ST_DWITHIN", - "operand": [ - { - "operator": "ST_POINT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "GEOMETRY" - }, - { - "operator": "POINT (10 20)", - "operand": [], - "type": "GEOMETRY" - }, - { - "operator": "6", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\r\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT($2, $1), ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), 6)])\r\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\r\n", - "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\r\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]), ST_DWITHIN(ST_POINT($2, $1), POINT (10 20):GEOMETRY, 6))])\r\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSpatialDWithinToHilbert.json b/tests/RelOptRulesTest/testSpatialDWithinToHilbert.json deleted file mode 100644 index b93d118..0000000 --- a/tests/RelOptRulesTest/testSpatialDWithinToHilbert.json +++ /dev/null @@ -1,198 +0,0 @@ -{ - "schemas": [ - { - "name": "RESTAURANTS", - "fields": [ - "NAME", - "LATITUDE", - "LONGITUDE", - "CUISINE", - "HILBERT" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER", - "VARCHAR", - "BIGINT" - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "ST_DWITHIN", - "operand": [ - { - "operator": "ST_POINT", - "operand": [ - { - "operator": "10.0", - "operand": [], - "type": "DECIMAL" - }, - { - "operator": "20.0", - "operand": [], - "type": "DECIMAL" - } - ], - "type": "GEOMETRY" - }, - { - "operator": "ST_POINT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "GEOMETRY" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "SEARCH", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "Sarg[[28988..28989], [28991..28994], [29006..29009], [29011..29014], [32426..32429], [32431..32434], [32446..32449], [32451..32454], [32506..32509], [32511..32514], [32526..32527], [32929..32930], [32942..32949], [32951..32953], [32955..32970], [32973..32975], [33009..33011], [33014..33185], [33187..33190], [33205..33207], [33209..33211], [33226..33229], [33231..33265], [33267..33270], [36392..36401], [36403..36404], [36421..36423], [36425..36427], [36442..36445], [36447..36548], [36556..36568]]", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "ST_DWITHIN", - "operand": [ - { - "operator": "POINT (10 20)", - "operand": [], - "type": "GEOMETRY" - }, - { - "operator": "ST_POINT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "GEOMETRY" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\r\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), ST_POINT($2, $1), 10)])\r\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\r\n", - "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\r\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[28988..28989], [28991..28994], [29006..29009], [29011..29014], [32426..32429], [32431..32434], [32446..32449], [32451..32454], [32506..32509], [32511..32514], [32526..32527], [32929..32930], [32942..32949], [32951..32953], [32955..32970], [32973..32975], [33009..33011], [33014..33185], [33187..33190], [33205..33207], [33209..33211], [33226..33229], [33231..33265], [33267..33270], [36392..36401], [36403..36404], [36421..36423], [36425..36427], [36442..36445], [36447..36548], [36556..36568]]), ST_DWITHIN(POINT (10 20):GEOMETRY, ST_POINT($2, $1), 10))])\r\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSpatialDWithinToHilbertNegative.json b/tests/RelOptRulesTest/testSpatialDWithinToHilbertNegative.json deleted file mode 100644 index 0f4dbef..0000000 --- a/tests/RelOptRulesTest/testSpatialDWithinToHilbertNegative.json +++ /dev/null @@ -1,152 +0,0 @@ -{ - "schemas": [ - { - "name": "RESTAURANTS", - "fields": [ - "NAME", - "LATITUDE", - "LONGITUDE", - "CUISINE", - "HILBERT" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER", - "VARCHAR", - "BIGINT" - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "ST_DWITHIN", - "operand": [ - { - "operator": "ST_POINT", - "operand": [ - { - "operator": "10.0", - "operand": [], - "type": "DECIMAL" - }, - { - "operator": "20.0", - "operand": [], - "type": "DECIMAL" - } - ], - "type": "GEOMETRY" - }, - { - "operator": "ST_POINT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "GEOMETRY" - }, - { - "operator": "-2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "source": { - "values": { - "schema": [ - "VARCHAR", - "INTEGER", - "INTEGER", - "VARCHAR", - "BIGINT" - ], - "content": [] - } - } - } - } - ], - "help": [ - "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\r\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), ST_POINT($2, $1), -2)])\r\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\r\n", - "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\r\n LogicalValues(tuples=[[]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSpatialDWithinToHilbertZero.json b/tests/RelOptRulesTest/testSpatialDWithinToHilbertZero.json deleted file mode 100644 index f7b9126..0000000 --- a/tests/RelOptRulesTest/testSpatialDWithinToHilbertZero.json +++ /dev/null @@ -1,193 +0,0 @@ -{ - "schemas": [ - { - "name": "RESTAURANTS", - "fields": [ - "NAME", - "LATITUDE", - "LONGITUDE", - "CUISINE", - "HILBERT" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER", - "VARCHAR", - "BIGINT" - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "ST_DWITHIN", - "operand": [ - { - "operator": "ST_POINT", - "operand": [ - { - "operator": "10.0", - "operand": [], - "type": "DECIMAL" - }, - { - "operator": "20.0", - "operand": [], - "type": "DECIMAL" - } - ], - "type": "GEOMETRY" - }, - { - "operator": "ST_POINT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "GEOMETRY" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "33139", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "operator": "POINT (10 20)", - "operand": [], - "type": "GEOMETRY" - }, - { - "operator": "ST_POINT", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "GEOMETRY" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ], - "help": [ - "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\r\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), ST_POINT($2, $1), 0)])\r\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\r\n", - "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\r\n LogicalFilter(condition=[AND(=($4, 33139), =(POINT (10 20), ST_POINT($2, $1)))])\r\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSpatialReduce.json b/tests/RelOptRulesTest/testSpatialReduce.json deleted file mode 100644 index 988d29d..0000000 --- a/tests/RelOptRulesTest/testSpatialReduce.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "schemas": [ - { - "name": "RESTAURANTS", - "fields": [ - "HILBERT" - ], - "types": [ - "BIGINT" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "ST_BUFFER", - "operand": [ - { - "operator": "ST_POINT", - "operand": [ - { - "operator": "0.0", - "operand": [], - "type": "DECIMAL" - }, - { - "operator": "0.0", - "operand": [], - "type": "DECIMAL" - } - ], - "type": "GEOMETRY" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "GEOMETRY" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "operator": "CAST", - "operand": [ - { - "operator": "POLYGON ((1 0, 0.9238795325112867 -0.3826834323650898, 0.7071067811865476 -0.7071067811865475, 0.3826834323650898 -0.9238795325112867, 0.0000000000000001 -1, -0.3826834323650897 -0.9238795325112867, -0.7071067811865475 -0.7071067811865476, -0.9238795325112867 -0.3826834323650899, -1 -0.0000000000000001, -0.9238795325112868 0.3826834323650897, -0.7071067811865477 0.7071067811865475, -0.3826834323650903 0.9238795325112865, -0.0000000000000002 1, 0.38268343236509 0.9238795325112866, 0.7071067811865474 0.7071067811865477, 0.9238795325112865 0.3826834323650904, 1 0))", - "operand": [], - "type": "GEOMETRY" - } - ], - "type": "GEOMETRY" - } - ], - "source": { - "scan": 0 - } - } - } - ], - "help": [ - "LogicalProject(B=[ST_BUFFER(ST_POINT(0.0:DECIMAL(2, 1), 0.0:DECIMAL(2, 1)), 1, 4)])\r\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\r\n", - "LogicalProject(B=[CAST(POLYGON ((1 0, 0.9238795325112867 -0.3826834323650898, 0.7071067811865476 -0.7071067811865475, 0.3826834323650898 -0.9238795325112867, 0.0000000000000001 -1, -0.3826834323650897 -0.9238795325112867, -0.7071067811865475 -0.7071067811865476, -0.9238795325112867 -0.3826834323650899, -1 -0.0000000000000001, -0.9238795325112868 0.3826834323650897, -0.7071067811865477 0.7071067811865475, -0.3826834323650903 0.9238795325112865, -0.0000000000000002 1, 0.38268343236509 0.9238795325112866, 0.7071067811865474 0.7071067811865477, 0.9238795325112865 0.3826834323650904, 1 0)):GEOMETRY):GEOMETRY])\r\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testStrengthenJoinType.json b/tests/RelOptRulesTest/testStrengthenJoinType.json deleted file mode 100644 index d54ac40..0000000 --- a/tests/RelOptRulesTest/testStrengthenJoinType.json +++ /dev/null @@ -1,375 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "TIMESTAMP" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "TIMESTAMP" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 10, - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 6, - "type": "TIMESTAMP" - } - ], - "type": "TIMESTAMP" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 8, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 10, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "100", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\r\n LogicalFilter(condition=[AND(IS NOT NULL($9), >($7, 100))])\r\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\r\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[CAST($2):INTEGER], ENAME=[CAST($3):VARCHAR(20)], JOB=[CAST($4):VARCHAR(10)], MGR=[$5], HIREDATE=[CAST($6):TIMESTAMP(0)], SAL=[CAST($7):INTEGER], COMM=[CAST($8):INTEGER], DEPTNO0=[CAST($9):INTEGER], SLACKER=[CAST($10):BOOLEAN])\r\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalFilter(condition=[>($5, 100)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSumAndDistinctSumWithExpandSumType.json b/tests/RelOptRulesTest/testSumAndDistinctSumWithExpandSumType.json deleted file mode 100644 index 3d75567..0000000 --- a/tests/RelOptRulesTest/testSumAndDistinctSumWithExpandSumType.json +++ /dev/null @@ -1,278 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "COMM" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "operator": "CAST", - "operand": [ - { - "column": 0, - "type": "DECIMAL" - } - ], - "type": "BIGINT" - }, - { - "column": 1, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 1, - "type": "BIGINT" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "DECIMAL" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[SUM(DISTINCT $0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[CAST($0):BIGINT], EXPR$1=[$1])\r\n LogicalAggregate(group=[{}], EXPR$0=[SUM($1)], EXPR$1=[SUM($0)])\r\n LogicalAggregate(group=[{0}], EXPR$0=[SUM($0)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testSwapOuterJoin.json b/tests/RelOptRulesTest/testSwapOuterJoin.json deleted file mode 100644 index 7d99fc9..0000000 --- a/tests/RelOptRulesTest/testSwapOuterJoin.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 1 - }, - "right": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalProject(DUMMY=[0])\r\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testTransitiveInferenceAggregate.json b/tests/RelOptRulesTest/testTransitiveInferenceAggregate.json deleted file mode 100644 index 0d5afd7..0000000 --- a/tests/RelOptRulesTest/testTransitiveInferenceAggregate.json +++ /dev/null @@ -1,287 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - "right": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalAggregate(group=[{0}])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalAggregate(group=[{0}])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testTransitiveInferenceComplexPredicate.json b/tests/RelOptRulesTest/testTransitiveInferenceComplexPredicate.json deleted file mode 100644 index fc334d4..0000000 --- a/tests/RelOptRulesTest/testTransitiveInferenceComplexPredicate.json +++ /dev/null @@ -1,361 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "/", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "/", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($1, $3)], joinType=[inner])\r\n LogicalFilter(condition=[AND(>($1, 7), =($0, $1), >(+($0, $1), /($0, 2)))])\r\n LogicalProject(COMM=[$1], DEPTNO=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[=($0, $1)])\r\n LogicalProject(SAL=[$0], DEPTNO=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($1, $3)], joinType=[inner])\r\n LogicalFilter(condition=[AND(>($1, 7), =($0, $1), >(+($0, $1), /($0, 2)))])\r\n LogicalProject(COMM=[$1], DEPTNO=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($1, 7)])\r\n LogicalFilter(condition=[=($0, $1)])\r\n LogicalProject(SAL=[$0], DEPTNO=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testTransitiveInferenceConjunctInPullUp.json b/tests/RelOptRulesTest/testTransitiveInferenceConjunctInPullUp.json deleted file mode 100644 index a613954..0000000 --- a/tests/RelOptRulesTest/testTransitiveInferenceConjunctInPullUp.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "SEARCH", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "Sarg[7, 9, (10..+∞)]", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "SEARCH", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "Sarg[7, 9, (10..+∞)]", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "filter": { - "condition": { - "operator": "SEARCH", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "Sarg[7, 9, (10..+∞)]", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalFilter(condition=[SEARCH($0, Sarg[7, 9, (10..+∞)])])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalFilter(condition=[SEARCH($0, Sarg[7, 9, (10..+∞)])])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[SEARCH($0, Sarg[7, 9, (10..+∞)])])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testTransitiveInferenceJoin.json b/tests/RelOptRulesTest/testTransitiveInferenceJoin.json deleted file mode 100644 index 7c67788..0000000 --- a/tests/RelOptRulesTest/testTransitiveInferenceJoin.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testTransitiveInferenceJoin3way.json b/tests/RelOptRulesTest/testTransitiveInferenceJoin3way.json deleted file mode 100644 index d60dc50..0000000 --- a/tests/RelOptRulesTest/testTransitiveInferenceJoin3way.json +++ /dev/null @@ -1,216 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 0 - } - } - }, - "right": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testTransitiveInferenceJoin3wayAgg.json b/tests/RelOptRulesTest/testTransitiveInferenceJoin3wayAgg.json deleted file mode 100644 index f4d911d..0000000 --- a/tests/RelOptRulesTest/testTransitiveInferenceJoin3wayAgg.json +++ /dev/null @@ -1,350 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - "right": { - "scan": 0 - } - } - }, - "right": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalAggregate(group=[{0}])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalAggregate(group=[{0}])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testTransitiveInferenceLeftOuterJoin.json b/tests/RelOptRulesTest/testTransitiveInferenceLeftOuterJoin.json deleted file mode 100644 index 813de58..0000000 --- a/tests/RelOptRulesTest/testTransitiveInferenceLeftOuterJoin.json +++ /dev/null @@ -1,191 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "9", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "9", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalFilter(condition=[>($1, 9)])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalFilter(condition=[>($1, 9)])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testTransitiveInferenceProject.json b/tests/RelOptRulesTest/testTransitiveInferenceProject.json deleted file mode 100644 index a0fb41e..0000000 --- a/tests/RelOptRulesTest/testTransitiveInferenceProject.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testTransitiveInferencePullUpThruAlias.json b/tests/RelOptRulesTest/testTransitiveInferencePullUpThruAlias.json deleted file mode 100644 index 27cf18a..0000000 --- a/tests/RelOptRulesTest/testTransitiveInferencePullUpThruAlias.json +++ /dev/null @@ -1,196 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "COMM", - "DEPTNO" - ], - "types": [ - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalProject(COMM=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalProject(COMM=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalProject(DEPTNO=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testTransitiveInferenceRightOuterJoin.json b/tests/RelOptRulesTest/testTransitiveInferenceRightOuterJoin.json deleted file mode 100644 index 6aebe24..0000000 --- a/tests/RelOptRulesTest/testTransitiveInferenceRightOuterJoin.json +++ /dev/null @@ -1,191 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "9", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "RIGHT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "9", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "9", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 9)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\r\n LogicalFilter(condition=[>($0, 9)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 9)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testTransitiveInferenceUnion.json b/tests/RelOptRulesTest/testTransitiveInferenceUnion.json deleted file mode 100644 index a505515..0000000 --- a/tests/RelOptRulesTest/testTransitiveInferenceUnion.json +++ /dev/null @@ -1,205 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "union": [ - { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - ] - }, - "right": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "union": [ - { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - ] - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalUnion(all=[true])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalUnion(all=[true])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testTransitiveInferenceUnion3way.json b/tests/RelOptRulesTest/testTransitiveInferenceUnion3way.json deleted file mode 100644 index b0a1e92..0000000 --- a/tests/RelOptRulesTest/testTransitiveInferenceUnion3way.json +++ /dev/null @@ -1,257 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "union": [ - { - "union": [ - { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - ] - }, - { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - ] - }, - "right": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "union": [ - { - "union": [ - { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - ] - }, - { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - ] - }, - "right": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalUnion(all=[true])\r\n LogicalUnion(all=[true])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EXPR$0=[1])\r\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalUnion(all=[true])\r\n LogicalUnion(all=[true])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[>($0, 1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testTransitiveInferenceUnionAlwaysTrue.json b/tests/RelOptRulesTest/testTransitiveInferenceUnionAlwaysTrue.json deleted file mode 100644 index ad13cc8..0000000 --- a/tests/RelOptRulesTest/testTransitiveInferenceUnionAlwaysTrue.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "union": [ - { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "scan": 0 - } - ] - } - } - }, - { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - "right": { - "filter": { - "condition": { - "operator": "<", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "7", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - }, - { - "scan": 0 - } - ] - } - } - } - } - } - ], - "help": [ - "LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalFilter(condition=[<($0, 4)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalUnion(all=[true])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalJoin(condition=[=($0, $1)], joinType=[inner])\r\n LogicalFilter(condition=[<($0, 4)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalFilter(condition=[<($0, 4)])\r\n LogicalUnion(all=[true])\r\n LogicalFilter(condition=[>($0, 7)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json b/tests/RelOptRulesTest/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json deleted file mode 100644 index 38297c6..0000000 --- a/tests/RelOptRulesTest/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json +++ /dev/null @@ -1,660 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 9, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "correlate": [ - { - "scan": 0 - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "<", - "operand": [ - { - "operator": "+", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "operator": "50", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "30", - "operand": [], - "type": "INTEGER" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 9, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "<", - "operand": [ - { - "operator": "+", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "operator": "50", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "30", - "operand": [], - "type": "INTEGER" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 9, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "correlate": [ - { - "scan": 0 - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [], - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "<", - "operand": [ - { - "operator": "+", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "operator": "50", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "30", - "operand": [], - "type": "INTEGER" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 9, - "type": "BOOLEAN" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "project": { - "target": [ - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "<", - "operand": [ - { - "operator": "+", - "operand": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "operator": "50", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "20", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "operator": "30", - "operand": [], - "type": "INTEGER" - }, - { - "column": 10, - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 16, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[IS NOT NULL($9)])\r\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\r\n LogicalProject($f0=[true])\r\n LogicalFilter(condition=[AND(<(+($0, 50), 20), >=($cor0.DEPTNO, +(30, $1)))])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[IS NOT NULL($9)])\r\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\r\n LogicalProject($f0=[true])\r\n LogicalProject(DUMMY=[0])\r\n LogicalFilter(condition=[AND(<(+($0, 50), 20), >=($cor0.DEPTNO, $1))])\r\n LogicalProject(EMPNO=[$0], $f9=[+(30, $1)])\r\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testUnionMergeRule.json b/tests/RelOptRulesTest/testUnionMergeRule.json deleted file mode 100644 index e4aee00..0000000 --- a/tests/RelOptRulesTest/testUnionMergeRule.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "union": [ - { - "union": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "union": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - ] - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - }, - { - "union": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - ] - } - ], - "help": [ - "LogicalUnion(all=[true])\r\n LogicalUnion(all=[true])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalUnion(all=[true])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalUnion(all=[true])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testUnionToDistinctRule.json b/tests/RelOptRulesTest/testUnionToDistinctRule.json deleted file mode 100644 index 0425e8d..0000000 --- a/tests/RelOptRulesTest/testUnionToDistinctRule.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "union": [ - { - "scan": 0 - }, - { - "scan": 0 - } - ] - } - } - } - } - } - ] - } - } - ], - "help": [ - "LogicalUnion(all=[false])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalAggregate(group=[{0, 1}])\r\n LogicalUnion(all=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testWhereAnyCorrelatedInSelect.json b/tests/RelOptRulesTest/testWhereAnyCorrelatedInSelect.json deleted file mode 100644 index da6fdd6..0000000 --- a/tests/RelOptRulesTest/testWhereAnyCorrelatedInSelect.json +++ /dev/null @@ -1,519 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "> SOME", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 10, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - }, - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 13, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT TRUE", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 12, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT TRUE", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 12, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT TRUE", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT TRUE", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "column": 11, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BIGINT" - }, - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[> SOME($0, {\nLogicalProject(DEPTNO=[$0])\r\n LogicalFilter(condition=[=($cor0.JOB, $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n})], variablesSet=[[$cor0]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalJoin(condition=[AND(=($2, $13), OR(AND(>($0, $9), IS NOT TRUE(OR(IS NULL($12), =($10, 0)))), AND(>($0, $9), IS NOT TRUE(OR(IS NULL($12), =($10, 0))), IS NOT TRUE(>($0, $9)), IS NOT TRUE(>($10, $11)))))], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(m=[$1], c=[$2], d=[$2], trueLiteral=[true], NAME=[$0])\r\n LogicalAggregate(group=[{0}], m=[MIN($1)], c=[COUNT()])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testWhereExpressionInCorrelated.json b/tests/RelOptRulesTest/testWhereExpressionInCorrelated.json deleted file mode 100644 index f9ede96..0000000 --- a/tests/RelOptRulesTest/testWhereExpressionInCorrelated.json +++ /dev/null @@ -1,414 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IN", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "column": 10, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "operator": "+", - "operand": [ - { - "column": 8, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(ENAME=[$0])\r\n LogicalFilter(condition=[IN($1, {\nLogicalProject(DEPTNO=[$7])\r\n LogicalFilter(condition=[=(+($5, 1), $cor0.SALPLUS)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n})], variablesSet=[[$cor0]])\r\n LogicalProject(ENAME=[$0], DEPTNO=[$2], SALPLUS=[+($1, 1)])\r\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(ENAME=[$0])\r\n LogicalJoin(condition=[AND(=($2, $4), =($1, $3))], joinType=[inner])\r\n LogicalProject(ENAME=[$0], DEPTNO=[$2], SALPLUS=[+($1, 1)])\r\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(DEPTNO=[$1], $f9=[+($0, 1)])\r\n LogicalProject(SAL=[$5], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testWhereExpressionInCorrelated2.json b/tests/RelOptRulesTest/testWhereExpressionInCorrelated2.json deleted file mode 100644 index 7904dd8..0000000 --- a/tests/RelOptRulesTest/testWhereExpressionInCorrelated2.json +++ /dev/null @@ -1,399 +0,0 @@ -{ - "schemas": [ - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IN", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "column": 10, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "operator": "+", - "operand": [ - { - "column": 8, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - }, - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "-", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "-", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "+", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(NAME=[$0])\r\n LogicalFilter(condition=[IN($1, {\nLogicalProject(DEPTNO=[$7])\r\n LogicalFilter(condition=[=(+($5, 1), $cor0.DEPTNOMINUS)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n})], variablesSet=[[$cor0]])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0], DEPTNOMINUS=[-($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(NAME=[$0])\r\n LogicalJoin(condition=[AND(=($2, $4), =($1, $3))], joinType=[inner])\r\n LogicalProject(NAME=[$1], DEPTNO=[$0], DEPTNOMINUS=[-($0, 10)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalAggregate(group=[{0, 1}])\r\n LogicalProject(DEPTNO=[$1], $f9=[+($0, 1)])\r\n LogicalProject(SAL=[$5], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testWhereInCorrelated.json b/tests/RelOptRulesTest/testWhereInCorrelated.json deleted file mode 100644 index dae0799..0000000 --- a/tests/RelOptRulesTest/testWhereInCorrelated.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "JOB", - "SAL" - ], - "types": [ - "INTEGER", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IN", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - }, - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - } - } - } - ], - "help": [ - "LogicalProject(SAL=[$2])\r\n LogicalFilter(condition=[IN($0, {\nLogicalProject(DEPTNO=[$0])\r\n LogicalFilter(condition=[=($cor0.JOB, $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n})], variablesSet=[[$cor0]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(SAL=[$2])\r\n LogicalJoin(condition=[AND(=($1, $4), =($0, $3))], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testWhereInJoinCorrelated.json b/tests/RelOptRulesTest/testWhereInJoinCorrelated.json deleted file mode 100644 index 97dcf90..0000000 --- a/tests/RelOptRulesTest/testWhereInJoinCorrelated.json +++ /dev/null @@ -1,373 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "IN", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "column": 9, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 11, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 11, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "correlate": [ - { - "join": { - "kind": "INNER", - "condition": { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "scan": 1 - } - } - }, - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 11, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 11, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 12, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 16, - "type": "INTEGER" - }, - { - "column": 18, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 11, - "type": "INTEGER" - }, - { - "column": 12, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 12, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 13, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 17, - "type": "INTEGER" - }, - { - "column": 19, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - ] - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[IN($1, {\nLogicalProject(SAL=[$5])\r\n LogicalFilter(condition=[>($7, $cor0.DEPTNO)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n})], variablesSet=[[$cor0]])\r\n LogicalJoin(condition=[=($2, $3)], joinType=[inner])\r\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DEPTNO=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n", - "LogicalProject(EMPNO=[$0])\r\n LogicalFilter(condition=[=($5, $11)])\r\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{7}])\r\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalAggregate(group=[{0}])\r\n LogicalProject(SAL=[$0])\r\n LogicalFilter(condition=[>($1, $cor0.DEPTNO)])\r\n LogicalProject(SAL=[$5], DEPTNO=[$7])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testWhereNotInCorrelated.json b/tests/RelOptRulesTest/testWhereNotInCorrelated.json deleted file mode 100644 index e49e5e9..0000000 --- a/tests/RelOptRulesTest/testWhereNotInCorrelated.json +++ /dev/null @@ -1,370 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "JOB", - "SAL" - ], - "types": [ - "INTEGER", - "VARCHAR", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO", - "NAME" - ], - "types": [ - "INTEGER", - "VARCHAR" - ], - "nullable": [ - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "NOT", - "operand": [ - { - "operator": "IN", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 1 - } - } - } - } - }, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT TRUE", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 7, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 8, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(SAL=[$2])\r\n LogicalFilter(condition=[NOT(IN($0, {\nLogicalProject(DEPTNO=[$0])\r\n LogicalFilter(condition=[=($cor0.JOB, $1)])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n}))], variablesSet=[[$cor0]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(SAL=[$2])\r\n LogicalFilter(condition=[OR(=($3, 0), IS NOT TRUE(OR(IS NOT NULL($7), <($4, $3))))])\r\n LogicalJoin(condition=[AND(=($0, $6), =($1, $8))], joinType=[left])\r\n LogicalJoin(condition=[=($1, $5)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(c=[$1], ck=[$1], NAME=[$0])\r\n LogicalAggregate(group=[{0}], c=[COUNT()])\r\n LogicalProject(NAME=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n LogicalProject(DEPTNO=[$0], i=[true], NAME=[$1])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testWhereNotInCorrelated2.json b/tests/RelOptRulesTest/testWhereNotInCorrelated2.json deleted file mode 100644 index b2f1e6b..0000000 --- a/tests/RelOptRulesTest/testWhereNotInCorrelated2.json +++ /dev/null @@ -1,591 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "NOT", - "operand": [ - { - "operator": "IN", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "query": { - "project": { - "target": [ - { - "column": 10, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 11, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 9, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 10, - "type": "VARCHAR" - }, - { - "column": 9, - "type": "INTEGER" - }, - { - "column": 14, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - }, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NOT TRUE", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "IS NOT NULL", - "operand": [ - { - "column": 13, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "<", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "column": 9, - "type": "BIGINT" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 12, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 14, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "left": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 11, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 1, - "type": "BIGINT" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - "right": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "filter": { - "condition": { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[NOT(IN($0, {\nLogicalProject(EMPNO=[$1])\r\n LogicalFilter(condition=[AND(>($2, 2), =($cor0.ENAME, $0))])\r\n LogicalProject(ENAME=[$1], EMPNO=[$0], R=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n}))], variablesSet=[[$cor0]])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[OR(=($9, 0), IS NOT TRUE(OR(IS NOT NULL($13), <($10, $9))))])\r\n LogicalJoin(condition=[AND(=($0, $12), =($1, $14))], joinType=[left])\r\n LogicalJoin(condition=[=($1, $11)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(c=[$1], ck=[$1], ENAME=[$0])\r\n LogicalAggregate(group=[{0}], c=[COUNT()])\r\n LogicalProject(ENAME=[$0])\r\n LogicalFilter(condition=[>($1, 2)])\r\n LogicalProject(ENAME=[$1], SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(EMPNO=[$1], i=[true], ENAME=[$0])\r\n LogicalFilter(condition=[>($2, 2)])\r\n LogicalProject(ENAME=[$1], EMPNO=[$0], R=[$2])\r\n LogicalProject(EMPNO=[$0], ENAME=[$1], SAL=[$5])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testWhereOrSubQuery.json b/tests/RelOptRulesTest/testWhereOrSubQuery.json deleted file mode 100644 index 5b7cbcc..0000000 --- a/tests/RelOptRulesTest/testWhereOrSubQuery.json +++ /dev/null @@ -1,276 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "EMPNO", - "ENAME", - "JOB", - "MGR", - "HIREDATE", - "SAL", - "COMM", - "DEPTNO", - "SLACKER" - ], - "types": [ - "INTEGER", - "VARCHAR", - "VARCHAR", - "INTEGER", - "TIMESTAMP", - "INTEGER", - "INTEGER", - "INTEGER", - "BOOLEAN" - ], - "nullable": [ - false, - false, - false, - true, - false, - false, - false, - false, - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - }, - { - "name": "DEPT", - "fields": [ - "DEPTNO" - ], - "types": [ - "INTEGER" - ], - "nullable": [ - false - ], - "key": [ - [ - 0 - ] - ], - "guaranteed": [] - } - ], - "queries": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NOT", - "operand": [ - { - "operator": "IN", - "operand": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "query": { - "scan": 1 - }, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "scan": 0 - } - } - } - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "TIMESTAMP" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "BOOLEAN" - } - ], - "source": { - "filter": { - "condition": { - "operator": "OR", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "4", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 10, - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "join": { - "kind": "LEFT", - "condition": { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 9, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - "left": { - "scan": 0 - }, - "right": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "true", - "operand": [], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 1 - } - } - } - } - } - } - } - } - } - ], - "help": [ - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[OR(=($5, 4), NOT(IN($0, {\nLogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n})))])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\r\n LogicalFilter(condition=[OR(=($5, 4), IS NULL($10))])\r\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n LogicalProject(DEPTNO=[$0], i=[true])\r\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testWithinDistinct.json b/tests/RelOptRulesTest/testWithinDistinct.json deleted file mode 100644 index 92213ba..0000000 --- a/tests/RelOptRulesTest/testWithinDistinct.json +++ /dev/null @@ -1,752 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "$THROW_UNLESS", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "<>", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "$SUM0", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 6, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 6, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "$THROW_UNLESS", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "<>", - "operand": [ - { - "column": 6, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[SUM($1) WITHIN DISTINCT ($2)])\r\n LogicalProject(DEPTNO=[$2], SAL=[$1], JOB=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], $f1=[CAST($1):INTEGER NOT NULL], $f2=[$2])\r\n LogicalAggregate(group=[{0}], agg#0=[MIN($1) FILTER $3], agg#1=[$SUM0($2) FILTER $4])\r\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f3=[$3], $f6=[=($5, 1)], $f7=[AND(=($5, 0), $THROW_UNLESS(OR(<>($5, 0), =($3, $4)), 'more than one distinct value in agg UNIQUE_VALUE'))])\r\n LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}]], agg#0=[$SUM0($1)], agg#1=[MIN($1)], agg#2=[MAX($1)], agg#3=[GROUPING($0, $2)])\r\n LogicalProject(DEPTNO=[$2], SAL=[$1], JOB=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testWithinDistinctCountDistinct.json b/tests/RelOptRulesTest/testWithinDistinctCountDistinct.json deleted file mode 100644 index b7bbf1f..0000000 --- a/tests/RelOptRulesTest/testWithinDistinctCountDistinct.json +++ /dev/null @@ -1,915 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - } - ], - "distinct": true, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BIGINT" - }, - { - "column": 2, - "type": "BIGINT" - }, - { - "column": 2, - "type": "BIGINT" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "column": 6, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 6, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 6, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": ">", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 6, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "VARCHAR" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": ">", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "COUNT", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "VARCHAR" - }, - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 6, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": ">", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 7, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "VARCHAR" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 7, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "1000", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], SS_C=[SUM($1) WITHIN DISTINCT ($2)], CDJ=[COUNT(DISTINCT $3)], CJ_J=[COUNT() WITHIN DISTINCT ($3)], CDJ_J=[COUNT(DISTINCT $3) WITHIN DISTINCT ($3)], CDJ_FILTERED=[COUNT(DISTINCT $3) FILTER $4])\r\n LogicalProject(DEPTNO=[$3], SAL=[$1], COMM=[$2], JOB=[$0], $f4=[>($1, 1000)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], $f1=[$1], $f2=[$2], $f20=[$2], $f21=[$2], $f3=[$3])\r\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[COUNT($2) FILTER $5])\r\n LogicalProject(DEPTNO=[$0], $f3=[$3], $f4=[$4], $f7=[=($6, 1)], $f8=[=($6, 2)], $f9=[AND(=($6, 2), >($5, 0))])\r\n LogicalAggregate(group=[{0, 2, 3}], groups=[[{0, 2}, {0, 3}]], agg#0=[MIN($1)], agg#1=[MIN($3) FILTER $4], agg#2=[COUNT() FILTER $4], agg#3=[GROUPING($0, $2, $3)])\r\n LogicalProject(DEPTNO=[$3], SAL=[$1], COMM=[$2], JOB=[$0], $f4=[>($1, 1000)])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testWithinDistinctFilteredAggs.json b/tests/RelOptRulesTest/testWithinDistinctFilteredAggs.json deleted file mode 100644 index 8354590..0000000 --- a/tests/RelOptRulesTest/testWithinDistinctFilteredAggs.json +++ /dev/null @@ -1,1596 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB", - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "AVG", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "/", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "$THROW_UNLESS", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "<>", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 8, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "$THROW_UNLESS", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "<>", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 8, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 6, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "$SUM0", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 6, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "$THROW_UNLESS", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "<>", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 6, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "$THROW_UNLESS", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "<>", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 8, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 10, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 8, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 8, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 7, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 7, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 8, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 5, - "type": "VARCHAR" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($1) FILTER $5])\r\n LogicalProject(DEPTNO=[$4], SAL=[$2], $f2=[>($3, 10)], JOB=[$1], COMM=[$3], $f5=[LIKE($0, '%ok%')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/($3, $4)):INTEGER])\r\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $f2=[$2], $f3=[CASE(=($4, 0), null:INTEGER, $3)], $f4=[$4])\r\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[$SUM0($2) FILTER $5], agg#3=[COUNT() FILTER $6])\r\n LogicalProject(DEPTNO=[$0], $f3=[$3], $f6=[$6], $f10=[AND(=($9, 2), >($5, 0), $THROW_UNLESS(OR(<>($9, 2), AND(IS NULL($3), IS NULL($4)), IS TRUE(=($3, $4))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f11=[AND(=($9, 2), >($5, 0))], $f12=[AND(=($9, 1), >($8, 0), $THROW_UNLESS(OR(<>($9, 1), AND(IS NULL($6), IS NULL($7)), IS TRUE(=($6, $7))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f13=[AND(=($9, 1), >($8, 0))])\r\n LogicalAggregate(group=[{0, 1, 3}], groups=[[{0, 1}, {0, 3}]], agg#0=[MIN($1) FILTER $2], agg#1=[MAX($1) FILTER $2], agg#2=[COUNT() FILTER $2], agg#3=[MIN($4) FILTER $5], agg#4=[MAX($4) FILTER $5], agg#5=[COUNT() FILTER $5], agg#6=[GROUPING($0, $1, $3)])\r\n LogicalProject(DEPTNO=[$4], SAL=[$2], $f2=[>($3, 10)], JOB=[$1], COMM=[$3], $f5=[LIKE($0, '%ok%')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testWithinDistinctFilteredAggsSameFilter.json b/tests/RelOptRulesTest/testWithinDistinctFilteredAggsSameFilter.json deleted file mode 100644 index 2f100c4..0000000 --- a/tests/RelOptRulesTest/testWithinDistinctFilteredAggsSameFilter.json +++ /dev/null @@ -1,1492 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB", - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "AVG", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "/", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 8, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "$THROW_UNLESS", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "<>", - "operand": [ - { - "column": 8, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 8, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 8, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "$THROW_UNLESS", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "<>", - "operand": [ - { - "column": 8, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 8, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 6, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "$SUM0", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 6, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "$THROW_UNLESS", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "<>", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "2", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 6, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 6, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "$THROW_UNLESS", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "<>", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 8, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 8, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 9, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 6, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 8, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 8, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 7, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 7, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 8, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 4, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - { - "column": 5, - "type": "VARCHAR" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($1) FILTER $2])\r\n LogicalProject(DEPTNO=[$4], SAL=[$2], $f2=[LIKE($0, '%ok%')], JOB=[$1], COMM=[$3])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/($3, $4)):INTEGER])\r\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $f2=[$2], $f3=[CASE(=($4, 0), null:INTEGER, $3)], $f4=[$4])\r\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[$SUM0($2) FILTER $5], agg#3=[COUNT() FILTER $6])\r\n LogicalProject(DEPTNO=[$0], $f3=[$3], $f6=[$6], $f9=[AND(=($8, 2), >($5, 0), $THROW_UNLESS(OR(<>($8, 2), AND(IS NULL($3), IS NULL($4)), IS TRUE(=($3, $4))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f10=[AND(=($8, 2), >($5, 0))], $f11=[AND(=($8, 1), >($5, 0), $THROW_UNLESS(OR(<>($8, 1), AND(IS NULL($6), IS NULL($7)), IS TRUE(=($6, $7))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f12=[AND(=($8, 1), >($5, 0))])\r\n LogicalAggregate(group=[{0, 1, 3}], groups=[[{0, 1}, {0, 3}]], agg#0=[MIN($1) FILTER $2], agg#1=[MAX($1) FILTER $2], agg#2=[COUNT() FILTER $2], agg#3=[MIN($4) FILTER $2], agg#4=[MAX($4) FILTER $2], agg#5=[GROUPING($0, $1, $3)])\r\n LogicalProject(DEPTNO=[$4], SAL=[$2], $f2=[LIKE($0, '%ok%')], JOB=[$1], COMM=[$3])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testWithinDistinctFilteredAggsUniformDistinctKeys.json b/tests/RelOptRulesTest/testWithinDistinctFilteredAggsUniformDistinctKeys.json deleted file mode 100644 index 70422c4..0000000 --- a/tests/RelOptRulesTest/testWithinDistinctFilteredAggsUniformDistinctKeys.json +++ /dev/null @@ -1,1316 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB", - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "AVG", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "/", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "$THROW_UNLESS", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 7, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "$THROW_UNLESS", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 7, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "$SUM0", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "$THROW_UNLESS", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "AND", - "operand": [ - { - "operator": ">", - "operand": [ - { - "column": 8, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "$THROW_UNLESS", - "operand": [ - { - "operator": "OR", - "operand": [ - { - "operator": "AND", - "operand": [ - { - "operator": "IS NULL", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS NULL", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "IS TRUE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 7, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 8, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($3) FILTER $5])\r\n LogicalProject(DEPTNO=[$4], SAL=[$2], $f2=[>($3, 10)], JOB=[$1], COMM=[$3], $f5=[LIKE($0, '%ok%')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/($3, $4)):INTEGER])\r\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $f2=[$2], $f3=[CASE(=($4, 0), null:INTEGER, $3)], $f4=[$4])\r\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[$SUM0($2) FILTER $5], agg#3=[COUNT() FILTER $6])\r\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f5=[$5], $f8=[AND(>($4, 0), $THROW_UNLESS(OR(AND(IS NULL($2), IS NULL($3)), IS TRUE(=($2, $3))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f9=[>($4, 0)], $f10=[AND(>($7, 0), $THROW_UNLESS(OR(AND(IS NULL($5), IS NULL($6)), IS TRUE(=($5, $6))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f11=[>($7, 0)])\r\n LogicalAggregate(group=[{0, 3}], agg#0=[MIN($1) FILTER $2], agg#1=[MAX($1) FILTER $2], agg#2=[COUNT() FILTER $2], agg#3=[MIN($4) FILTER $5], agg#4=[MAX($4) FILTER $5], agg#5=[COUNT() FILTER $5])\r\n LogicalProject(DEPTNO=[$4], SAL=[$2], $f2=[>($3, 10)], JOB=[$1], COMM=[$3], $f5=[LIKE($0, '%ok%')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json b/tests/RelOptRulesTest/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json deleted file mode 100644 index e340b05..0000000 --- a/tests/RelOptRulesTest/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json +++ /dev/null @@ -1,932 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "ENAME", - "JOB", - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "VARCHAR", - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "AVG", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "/", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 2, - "type": "BIGINT" - }, - { - "operator": "CASE", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "NULL", - "operand": [], - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 4, - "type": "BIGINT" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 0, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "$SUM0", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": ">", - "operand": [ - { - "column": 6, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 7, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 7, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": ">", - "operand": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "operator": "10", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "column": 4, - "type": "VARCHAR" - }, - { - "column": 6, - "type": "INTEGER" - }, - { - "operator": "LIKE", - "operand": [ - { - "column": 3, - "type": "VARCHAR" - }, - { - "operator": "_ISO-8859-1'%ok%'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($3) FILTER $5])\r\n LogicalProject(DEPTNO=[$4], SAL=[$2], $f2=[>($3, 10)], JOB=[$1], COMM=[$3], $f5=[LIKE($0, '%ok%')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/($3, $4)):INTEGER])\r\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $f2=[$2], $f3=[CASE(=($4, 0), null:INTEGER, $3)], $f4=[$4])\r\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $3], agg#2=[$SUM0($2) FILTER $4], agg#3=[COUNT() FILTER $4])\r\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f4=[$4], $f6=[>($3, 0)], $f7=[>($5, 0)])\r\n LogicalAggregate(group=[{0, 3}], agg#0=[MIN($1) FILTER $2], agg#1=[COUNT() FILTER $2], agg#2=[MIN($4) FILTER $5], agg#3=[COUNT() FILTER $5])\r\n LogicalProject(DEPTNO=[$4], SAL=[$2], $f2=[>($3, 10)], JOB=[$1], COMM=[$3], $f5=[LIKE($0, '%ok%')])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testWithinDistinctNoThrow.json b/tests/RelOptRulesTest/testWithinDistinctNoThrow.json deleted file mode 100644 index ec434ec..0000000 --- a/tests/RelOptRulesTest/testWithinDistinctNoThrow.json +++ /dev/null @@ -1,624 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "SAL", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "$SUM0", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "1", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "BIGINT" - }, - { - "operator": "0", - "operand": [], - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "GROUPING", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[SUM($1) WITHIN DISTINCT ($2)])\r\n LogicalProject(DEPTNO=[$2], SAL=[$1], JOB=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], $f1=[CAST($1):INTEGER NOT NULL], $f2=[$2])\r\n LogicalAggregate(group=[{0}], agg#0=[MIN($1) FILTER $3], agg#1=[$SUM0($2) FILTER $4])\r\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f3=[$3], $f5=[=($4, 1)], $f6=[=($4, 0)])\r\n LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}]], agg#0=[$SUM0($1)], agg#1=[MIN($1)], agg#2=[GROUPING($0, $2)])\r\n LogicalProject(DEPTNO=[$2], SAL=[$1], JOB=[$0])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testWithinDistinctUniformDistinctKeys.json b/tests/RelOptRulesTest/testWithinDistinctUniformDistinctKeys.json deleted file mode 100644 index ccf5466..0000000 --- a/tests/RelOptRulesTest/testWithinDistinctUniformDistinctKeys.json +++ /dev/null @@ -1,724 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "AVG", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "/", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "operator": "$THROW_UNLESS", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "$THROW_UNLESS", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "$SUM0", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 5, - "type": "INTEGER" - }, - { - "operator": "$THROW_UNLESS", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "$THROW_UNLESS", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 6, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand": [], - "type": "CHAR" - } - ], - "type": "BOOLEAN" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MAX", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($2)], EXPR$2=[AVG($3) WITHIN DISTINCT ($2)])\r\n LogicalProject(DEPTNO=[$3], SAL=[$1], JOB=[$0], COMM=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL])\r\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[$SUM0($2) FILTER $4], agg#2=[COUNT()])\r\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f4=[$4], $f6=[$THROW_UNLESS(=($2, $3), 'more than one distinct value in agg UNIQUE_VALUE')], $f7=[$THROW_UNLESS(=($4, $5), 'more than one distinct value in agg UNIQUE_VALUE')])\r\n LogicalAggregate(group=[{0, 2}], agg#0=[MIN($1)], agg#1=[MAX($1)], agg#2=[MIN($3)], agg#3=[MAX($3)])\r\n LogicalProject(DEPTNO=[$3], SAL=[$1], JOB=[$0], COMM=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/RelOptRulesTest/testWithinDistinctUniformDistinctKeysNoThrow.json b/tests/RelOptRulesTest/testWithinDistinctUniformDistinctKeysNoThrow.json deleted file mode 100644 index 8595228..0000000 --- a/tests/RelOptRulesTest/testWithinDistinctUniformDistinctKeysNoThrow.json +++ /dev/null @@ -1,540 +0,0 @@ -{ - "schemas": [ - { - "name": "EMP", - "fields": [ - "JOB", - "SAL", - "COMM", - "DEPTNO" - ], - "types": [ - "VARCHAR", - "INTEGER", - "INTEGER", - "INTEGER" - ], - "nullable": [ - false, - false, - false, - false - ], - "key": [], - "guaranteed": [] - } - ], - "queries": [ - { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "SUM", - "operand": [ - { - "column": 2, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "AVG", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - }, - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "operator": "CAST", - "operand": [ - { - "operator": "/", - "operand": [ - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 3, - "type": "BIGINT" - } - ], - "type": "BIGINT" - } - ], - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - } - ], - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 0, - "type": "VARCHAR" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 5, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 5, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - }, - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 4, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "$SUM0", - "operand": [ - { - "column": 3, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "$SUM0", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "COUNT", - "operand": [], - "distinct": false, - "ignoreNulls": false, - "type": "BIGINT" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 0, - "type": "INTEGER" - }, - { - "column": 1, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "distinct": { - "correlate": [ - { - "project": { - "target": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - } - ], - "source": { - "project": { - "target": [ - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 2, - "type": "INTEGER" - }, - { - "column": 1, - "type": "VARCHAR" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - }, - { - "aggregate": { - "function": [ - { - "operator": "MIN", - "operand": [ - { - "column": 4, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - }, - { - "operator": "MIN", - "operand": [ - { - "column": 6, - "type": "INTEGER" - } - ], - "distinct": false, - "ignoreNulls": false, - "type": "INTEGER" - } - ], - "source": { - "filter": { - "condition": { - "operator": "AND", - "operand": [ - { - "operator": "=", - "operand": [ - { - "column": 1, - "type": "INTEGER" - }, - { - "column": 3, - "type": "INTEGER" - } - ], - "type": "BOOLEAN" - }, - { - "operator": "=", - "operand": [ - { - "column": 2, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "VARCHAR" - } - ], - "type": "BOOLEAN" - } - ], - "type": "BOOLEAN" - }, - "source": { - "project": { - "target": [ - { - "column": 6, - "type": "INTEGER" - }, - { - "column": 4, - "type": "INTEGER" - }, - { - "column": 3, - "type": "VARCHAR" - }, - { - "column": 5, - "type": "INTEGER" - } - ], - "source": { - "scan": 0 - } - } - } - } - } - } - } - ] - } - } - } - } - } - } - ] - } - } - } - } - ], - "help": [ - "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($2)], EXPR$2=[AVG($3) WITHIN DISTINCT ($2)])\r\n LogicalProject(DEPTNO=[$3], SAL=[$1], JOB=[$0], COMM=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n", - "LogicalProject(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL])\r\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($2)], agg#1=[$SUM0($3)], agg#2=[COUNT()])\r\n LogicalAggregate(group=[{0, 2}], agg#0=[MIN($1)], agg#1=[MIN($3)])\r\n LogicalProject(DEPTNO=[$3], SAL=[$1], JOB=[$0], COMM=[$2])\r\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\r\n" - ] -} diff --git a/tests/benchmark/testAddRedundantSemiJoinRule.json b/tests/benchmark/testAddRedundantSemiJoinRule.json new file mode 100644 index 0000000..95cfc18 --- /dev/null +++ b/tests/benchmark/testAddRedundantSemiJoinRule.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":1}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalJoin(condition=[=($0, $1)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateCaseToFilter.json b/tests/benchmark/testAggregateCaseToFilter.json new file mode 100644 index 0000000..9503692 --- /dev/null +++ b/tests/benchmark/testAggregateCaseToFilter.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},{"column":7,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"40","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'x'","operand":[],"type":"CHAR"},{"operator":"NULL","operand":[],"type":"CHAR"}],"type":"CHAR"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"45","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"DECIMAL"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"70","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":5,"type":"CHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":8,"type":"DECIMAL"}],"distinct":false,"ignoreNulls":false,"type":"DECIMAL"},{"operator":"SUM","operand":[{"column":9,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":10,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},{"column":7,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"40","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'x'","operand":[],"type":"CHAR"},{"operator":"NULL","operand":[],"type":"CHAR"}],"type":"CHAR"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"45","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"DECIMAL"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"70","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BIGINT"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"operator":"CAST","operand":[{"column":4,"type":"BIGINT"}],"type":"INTEGER"},{"column":5,"type":"BIGINT"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"DECIMAL"},{"column":9,"type":"INTEGER"},{"column":10,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"DECIMAL"},{"column":7,"type":"INTEGER"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"40","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"45","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"<>","operand":[{"column":7,"type":"INTEGER"},{"operator":"70","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":10,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":12,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":1,"type":"DECIMAL"}],"distinct":false,"ignoreNulls":false,"type":"DECIMAL"},{"operator":"SUM","operand":[{"column":14,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"DECIMAL"},{"column":7,"type":"INTEGER"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"40","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"45","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"<>","operand":[{"column":7,"type":"INTEGER"},{"operator":"70","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)], COUNT_DISTINCT_CLERK=[COUNT(DISTINCT $1)], SUM_SAL_D10=[SUM($2)], SUM_SAL_D20=[SUM($3)], COUNT_D30=[SUM($4)], COUNT_D40=[COUNT($5)], COUNT_D45=[SUM($6)], COUNT_D50=[SUM($7)], SUM_NULL_D60=[SUM($8)], SUM_NULL_D70=[SUM($9)], COUNT_D20=[COUNT($10)])\n LogicalProject(SAL=[$5], $f1=[CASE(=($2, 'CLERK'), $7, null:INTEGER)], $f2=[CASE(=($7, 10), $5, null:INTEGER)], $f3=[CASE(=($7, 20), $5, 0)], $f4=[CASE(=($7, 30), 1, 0)], $f5=[CASE(=($7, 40), 'x', null:CHAR(1))], $f6=[CASE(=($7, 45), 1, null:INTEGER)], $f7=[CASE(=($7, 50), 1, null:INTEGER)], $f8=[null:DECIMAL(19, 9)], $f9=[CASE(=($7, 70), null:INTEGER, 1)], $f10=[CASE(=($7, 20), 1, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(SUM_SAL=[$0], COUNT_DISTINCT_CLERK=[$1], SUM_SAL_D10=[$2], SUM_SAL_D20=[$3], COUNT_D30=[CAST($4):INTEGER], COUNT_D40=[$5], COUNT_D45=[$6], COUNT_D50=[$7], SUM_NULL_D60=[$8], SUM_NULL_D70=[$9], COUNT_D20=[$10])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)], COUNT_DISTINCT_CLERK=[COUNT(DISTINCT $2) FILTER $3], SUM_SAL_D10=[SUM($4) FILTER $5], SUM_SAL_D20=[SUM($6) FILTER $7], COUNT_D30=[COUNT() FILTER $8], COUNT_D40=[COUNT() FILTER $9], COUNT_D45=[SUM($10) FILTER $11], COUNT_D50=[SUM($12) FILTER $13], SUM_NULL_D60=[SUM($1)], SUM_NULL_D70=[SUM($14) FILTER $15], COUNT_D20=[COUNT() FILTER $16])\n LogicalProject(SAL=[$5], $f8=[null:DECIMAL(19, 9)], DEPTNO=[$7], $f12=[=($2, 'CLERK')], SAL0=[$5], $f14=[=($7, 10)], SAL1=[$5], $f16=[=($7, 20)], $f17=[=($7, 30)], $f18=[=($7, 40)], $f19=[1], $f20=[=($7, 45)], $f21=[1], $f22=[=($7, 50)], $f23=[1], $f24=[<>($7, 70)], $f25=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateConstantKeyRule.json b/tests/benchmark/testAggregateConstantKeyRule.json new file mode 100644 index 0000000..0a11311 --- /dev/null +++ b/tests/benchmark/testAggregateConstantKeyRule.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":2,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}],"help":["LogicalProject(C=[$2])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$1], SAL=[$0])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(C=[$1])\n LogicalAggregate(group=[{0}], C=[COUNT()])\n LogicalProject(SAL=[$0])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateConstantKeyRule3.json b/tests/benchmark/testAggregateConstantKeyRule3.json new file mode 100644 index 0000000..3520567 --- /dev/null +++ b/tests/benchmark/testAggregateConstantKeyRule3.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","MGR"],"types":["VARCHAR","INTEGER"],"nullable":[false,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Clerk'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Clerk'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"_ISO-8859-1'Clerk'","operand":[],"type":"VARCHAR"},{"column":1,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Clerk'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Clerk'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}}}}],"help":["LogicalProject(JOB=[$1])\n LogicalFilter(condition=[>($2, 3)])\n LogicalAggregate(group=[{0, 1}], agg#0=[COUNT()])\n LogicalProject(MGR=[$1], JOB=[$0])\n LogicalFilter(condition=[AND(IS NULL($1), =($0, 'Clerk'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(JOB=[$0])\n LogicalFilter(condition=[>($1, 3)])\n LogicalProject(JOB=['Clerk':VARCHAR(10)], $f2=[$1])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalProject(MGR=[$1])\n LogicalFilter(condition=[AND(IS NULL($1), =($0, 'Clerk'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateDynamicFunction.json b/tests/benchmark/testAggregateDynamicFunction.json new file mode 100644 index 0000000..92e9ff7 --- /dev/null +++ b/tests/benchmark/testAggregateDynamicFunction.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["MGR","HIREDATE"],"types":["INTEGER","TIMESTAMP"],"nullable":[true,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"TIMESTAMP"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"TIMESTAMP"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"TIMESTAMP"},{"operator":"CURRENT_TIMESTAMP","operand":[],"type":"TIMESTAMP"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"TIMESTAMP"},{"column":3,"type":"TIMESTAMP"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"TIMESTAMP"},{"operator":"CURRENT_TIMESTAMP","operand":[],"type":"TIMESTAMP"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}}}}},{"project":{"target":[{"column":0,"type":"TIMESTAMP"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CURRENT_TIMESTAMP","operand":[],"type":"TIMESTAMP"},{"column":1,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"TIMESTAMP"},{"operator":"CURRENT_TIMESTAMP","operand":[],"type":"TIMESTAMP"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"TIMESTAMP"},{"operator":"CURRENT_TIMESTAMP","operand":[],"type":"TIMESTAMP"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}}}}],"help":["LogicalProject(HIREDATE=[$1])\n LogicalFilter(condition=[>($2, 3)])\n LogicalAggregate(group=[{0, 1}], agg#0=[COUNT()])\n LogicalFilter(condition=[AND(IS NULL($0), =($1, CURRENT_TIMESTAMP))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(HIREDATE=[$0])\n LogicalFilter(condition=[>($1, 3)])\n LogicalProject(HIREDATE=[CURRENT_TIMESTAMP], $f2=[$1])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalProject(MGR=[$0])\n LogicalFilter(condition=[AND(IS NULL($0), =($1, CURRENT_TIMESTAMP))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateExtractProjectRule.json b/tests/benchmark/testAggregateExtractProjectRule.json new file mode 100644 index 0000000..d35ce30 --- /dev/null +++ b/tests/benchmark/testAggregateExtractProjectRule.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateExtractProjectRuleWithGroupingSets.json b/tests/benchmark/testAggregateExtractProjectRuleWithGroupingSets.json new file mode 100644 index 0000000..29839dc --- /dev/null +++ b/tests/benchmark/testAggregateExtractProjectRuleWithGroupingSets.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","SAL","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}, {2}]], EXPR$2=[SUM($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}, {2}]], EXPR$2=[SUM($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateExtractProjectRuleWithGroupingSets2.json b/tests/benchmark/testAggregateExtractProjectRuleWithGroupingSets2.json new file mode 100644 index 0000000..294e506 --- /dev/null +++ b/tests/benchmark/testAggregateExtractProjectRuleWithGroupingSets2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {1}]], EXPR$2=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {1}]], EXPR$2=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateGroupingSetsProjectMerge.json b/tests/benchmark/testAggregateGroupingSetsProjectMerge.json new file mode 100644 index 0000000..bc982fe --- /dev/null +++ b/tests/benchmark/testAggregateGroupingSetsProjectMerge.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","SAL","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}],"help":["LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$1=[SUM($2)])\n LogicalProject(X=[$2], Y=[$0], Z=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(X=[$1], EXPR$1=[$2], Y=[$0])\n LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {2}, {}]], EXPR$1=[SUM($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove1.json b/tests/benchmark/testAggregateJoinRemove1.json new file mode 100644 index 0000000..00d9812 --- /dev/null +++ b/tests/benchmark/testAggregateJoinRemove1.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove10.json b/tests/benchmark/testAggregateJoinRemove10.json new file mode 100644 index 0000000..c2a9910 --- /dev/null +++ b/tests/benchmark/testAggregateJoinRemove10.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":1}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1, $2)])\n LogicalProject(DEPTNO=[$0], NAME=[$2], NAME0=[$4])\n LogicalJoin(condition=[=($0, $3)], joinType=[left])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $2, $4)])\n LogicalJoin(condition=[=($0, $3)], joinType=[left])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove11.json b/tests/benchmark/testAggregateJoinRemove11.json new file mode 100644 index 0000000..da7e488 --- /dev/null +++ b/tests/benchmark/testAggregateJoinRemove11.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO","SLACKER"],"types":["INTEGER","BOOLEAN"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$0], SLACKER=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove2.json b/tests/benchmark/testAggregateJoinRemove2.json new file mode 100644 index 0000000..7e2e495 --- /dev/null +++ b/tests/benchmark/testAggregateJoinRemove2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":1,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{1}], EXPR$1=[COUNT(DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove3.json b/tests/benchmark/testAggregateJoinRemove3.json new file mode 100644 index 0000000..5f581b8 --- /dev/null +++ b/tests/benchmark/testAggregateJoinRemove3.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$0], NAME=[$2])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $2)])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove4.json b/tests/benchmark/testAggregateJoinRemove4.json new file mode 100644 index 0000000..3e08569 --- /dev/null +++ b/tests/benchmark/testAggregateJoinRemove4.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}},{"scan":1}],"help":["LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove5.json b/tests/benchmark/testAggregateJoinRemove5.json new file mode 100644 index 0000000..20b7e2a --- /dev/null +++ b/tests/benchmark/testAggregateJoinRemove5.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$1], NAME=[$2])\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove6.json b/tests/benchmark/testAggregateJoinRemove6.json new file mode 100644 index 0000000..082849a --- /dev/null +++ b/tests/benchmark/testAggregateJoinRemove6.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":1,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$2], JOB=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{2}], EXPR$1=[COUNT(DISTINCT $0)])\n LogicalJoin(condition=[=($1, $2)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove7.json b/tests/benchmark/testAggregateJoinRemove7.json new file mode 100644 index 0000000..518f2ec --- /dev/null +++ b/tests/benchmark/testAggregateJoinRemove7.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove8.json b/tests/benchmark/testAggregateJoinRemove8.json new file mode 100644 index 0000000..a463ca1 --- /dev/null +++ b/tests/benchmark/testAggregateJoinRemove8.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":1}}}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":1}}}}},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$0], NAME0=[$3])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $2)])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove9.json b/tests/benchmark/testAggregateJoinRemove9.json new file mode 100644 index 0000000..3cfd72c --- /dev/null +++ b/tests/benchmark/testAggregateJoinRemove9.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":1}}}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":5,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"scan":1}}}}},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$0], NAME=[$3])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0, 2}])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateMerge1.json b/tests/benchmark/testAggregateMerge1.json new file mode 100644 index 0000000..f040ca4 --- /dev/null +++ b/tests/benchmark/testAggregateMerge1.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","MGR","SAL","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER","INTEGER"],"nullable":[false,true,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":7,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":6,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}],"help":["LogicalAggregate(group=[{1}], EXPR$1=[MIN($4)], Z=[MAX($3)], EXPR$3=[SUM($6)], N=[SUM($5)], SAL=[SUM($2)])\n LogicalAggregate(group=[{0, 3}], X=[SUM($2)], Z=[MAX($2)], Y=[MIN($2)], M=[COUNT()], R=[COUNT($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{2}], EXPR$1=[MIN($1)], Z=[MAX($1)], EXPR$3=[COUNT($0)], N=[COUNT()], SAL=[SUM($1)])\n LogicalProject(MGR=[$1], SAL=[$2], DEPTNO=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateMerge2.json b/tests/benchmark/testAggregateMerge2.json new file mode 100644 index 0000000..8d29fbb --- /dev/null +++ b/tests/benchmark/testAggregateMerge2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","MGR","SAL","DEPTNO"],"types":["INTEGER","VARCHAR","INTEGER","INTEGER","INTEGER"],"nullable":[false,false,true,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":6,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":8,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$2=[$2], EXPR$3=[$3])\n LogicalAggregate(group=[{0, 2}], groups=[[{0}, {2}]], EXPR$2=[SUM($3)], EXPR$3=[SUM($4)])\n LogicalAggregate(group=[{0, 1, 4}], X=[SUM($3)], Y=[COUNT($2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$2=[$2], EXPR$3=[$3])\n LogicalAggregate(group=[{0, 3}], groups=[[{0}, {3}]], EXPR$2=[SUM($2)], EXPR$3=[COUNT($1)])\n LogicalProject(EMPNO=[$0], MGR=[$2], SAL=[$3], DEPTNO=[$4])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateMerge8.json b/tests/benchmark/testAggregateMerge8.json new file mode 100644 index 0000000..e7363a3 --- /dev/null +++ b/tests/benchmark/testAggregateMerge8.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalAggregate(group=[{}], X=[SUM($0)], Z=[MIN($1)])\n LogicalAggregate(group=[{}], X=[SUM($0)], Y=[MIN($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], X=[SUM($0)], Z=[MIN($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateMergeSum0.json b/tests/benchmark/testAggregateMergeSum0.json new file mode 100644 index 0000000..3eac5c1 --- /dev/null +++ b/tests/benchmark/testAggregateMergeSum0.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalAggregate(group=[{}], agg#0=[$SUM0($2)])\n LogicalAggregate(group=[{0, 1}], COUNT_COMM=[COUNT()])\n LogicalProject(MGR=[$3], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateProjectMerge.json b/tests/benchmark/testAggregateProjectMerge.json new file mode 100644 index 0000000..d761722 --- /dev/null +++ b/tests/benchmark/testAggregateProjectMerge.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","SAL","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}],"help":["LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM($2)])\n LogicalProject(X=[$2], Y=[$0], Z=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(X=[$1], EXPR$1=[$2], Y=[$0])\n LogicalAggregate(group=[{0, 2}], EXPR$1=[SUM($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateProjectPullUpConstants.json b/tests/benchmark/testAggregateProjectPullUpConstants.json new file mode 100644 index 0000000..5706856 --- /dev/null +++ b/tests/benchmark/testAggregateProjectPullUpConstants.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","JOB","SAL"],"types":["INTEGER","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":"10","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0, 1, 2}], S=[SUM($2)])\n LogicalProject(JOB=[$1], EMPNO=[$0], SAL=[$2])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(JOB=[$0], EMPNO=[10], SAL=[$1], S=[$2])\n LogicalAggregate(group=[{0, 1}], S=[SUM($1)])\n LogicalProject(JOB=[$1], SAL=[$2])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateProjectPullUpConstants2.json b/tests/benchmark/testAggregateProjectPullUpConstants2.json new file mode 100644 index 0000000..cac8ac7 --- /dev/null +++ b/tests/benchmark/testAggregateProjectPullUpConstants2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","SAL"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'John'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'John'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"operator":"_ISO-8859-1'John'","operand":[],"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'John'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'John'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalFilter(condition=[=($0, 'John')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(ENAME=['John':VARCHAR(20)], SAL=[$0])\n LogicalAggregate(group=[{1}])\n LogicalFilter(condition=[=($0, 'John')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateRemove1.json b/tests/benchmark/testAggregateRemove1.json new file mode 100644 index 0000000..e8f2d32 --- /dev/null +++ b/tests/benchmark/testAggregateRemove1.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"BIT_AND","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"BIT_OR","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":4,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":"1","operand":[],"type":"BIGINT"}],"source":{"scan":0}}}],"help":["LogicalProject(EMPNO=[$0], EXPR$1=[$2], EXPR$2=[$3], EXPR$3=[$4], EXPR$4=[$5], EXPR$5=[$6], EXPR$6=[$7])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM($2)], EXPR$2=[MIN($2)], EXPR$3=[MAX($2)], EXPR$4=[BIT_AND($2)], EXPR$5=[BIT_OR($2)], EXPR$6=[COUNT(DISTINCT $2)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], EXPR$1=[$5], EXPR$2=[$5], EXPR$3=[$5], EXPR$4=[$5], EXPR$5=[$5], EXPR$6=[1:BIGINT])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateRemove2.json b/tests/benchmark/testAggregateRemove2.json new file mode 100644 index 0000000..6eecdc7 --- /dev/null +++ b/tests/benchmark/testAggregateRemove2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"scan":0},{"scan":0}],"help":["LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateRemove3.json b/tests/benchmark/testAggregateRemove3.json new file mode 100644 index 0000000..ab53415 --- /dev/null +++ b/tests/benchmark/testAggregateRemove3.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"BIGINT"},{"operator":"0","operand":[],"type":"BIGINT"}],"type":"BIGINT"}],"source":{"scan":0}}}],"help":["LogicalProject(EMPNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT($2)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], EXPR$1=[CASE(IS NOT NULL($3), 1:BIGINT, 0:BIGINT)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateRemove7.json b/tests/benchmark/testAggregateRemove7.json new file mode 100644 index 0000000..e0b2ada --- /dev/null +++ b/tests/benchmark/testAggregateRemove7.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["MGR","SAL","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[true,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(MGR=[$0], SUM_SAL=[$2])\n LogicalFilter(condition=[=($1, 100)])\n LogicalAggregate(group=[{0, 1}], SUM_SAL=[SUM($2)])\n LogicalProject(MGR=[$0], DEPTNO=[$2], SAL=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(MGR=[$0], SUM_SAL=[$2])\n LogicalFilter(condition=[=($1, 100)])\n LogicalAggregate(group=[{0, 1}], SUM_SAL=[SUM($2)])\n LogicalProject(MGR=[$0], DEPTNO=[$2], SAL=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateUnionTransposeWithOneInputUnique.json b/tests/benchmark/testAggregateUnionTransposeWithOneInputUnique.json new file mode 100644 index 0000000..f942eca --- /dev/null +++ b/tests/benchmark/testAggregateUnionTransposeWithOneInputUnique.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"union":[{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":8,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], T=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], T=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(DEPTNO=[$7], T=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], T=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json b/tests/benchmark/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json new file mode 100644 index 0000000..324cf59 --- /dev/null +++ b/tests/benchmark/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"union":[{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":8,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":8,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":8,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":8,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":8,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":8,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], T2=[$0])\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT($0)])\n LogicalUnion(all=[true])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$1], T2=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT($0)])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT($0)])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAll.json b/tests/benchmark/testAll.json new file mode 100644 index 0000000..9fb9c9b --- /dev/null +++ b/tests/benchmark/testAll.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"NOT","operand":[{"operator":"<= SOME","operand":[{"column":0,"type":"INTEGER"}],"query":{"scan":1},"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"NOT","operand":[{"operator":"CAST","operand":[{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"IS TRUE","operand":[{"operator":"<=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":10,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":10,"type":"BIGINT"},{"column":11,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":10,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":"<=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"<=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":10,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":"<=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<=","operand":[{"column":10,"type":"BIGINT"},{"column":11,"type":"BIGINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BIGINT"},{"column":1,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[NOT(<= SOME($0, {\nLogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n}))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[NOT(CAST(OR(AND(IS TRUE(<=($0, $9)), <>($10, 0)), AND(>($10, $11), null, <>($10, 0), IS NOT TRUE(<=($0, $9))), AND(<=($0, $9), <>($10, 0), IS NOT TRUE(<=($0, $9)), <=($10, $11)))):BOOLEAN NOT NULL)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(m=[$0], c=[$1], d=[$1])\n LogicalAggregate(group=[{}], m=[MAX($0)], c=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAlreadyFalseEliminatesFilter.json b/tests/benchmark/testAlreadyFalseEliminatesFilter.json new file mode 100644 index 0000000..1443f51 --- /dev/null +++ b/tests/benchmark/testAlreadyFalseEliminatesFilter.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}]]}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[]}}}}],"help":["LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalFilter(condition=[false])\n LogicalValues(tuples=[[{ 1, 2 }]])\n","LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAntiJoinProjectTranspose.json b/tests/benchmark/testAntiJoinProjectTranspose.json new file mode 100644 index 0000000..393f30b --- /dev/null +++ b/tests/benchmark/testAntiJoinProjectTranspose.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","DNAME","LOC"],"types":["TINYINT","VARCHAR","VARCHAR"],"nullable":[false,true,true],"key":[[0],[1],[2]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","DNAME","LOC"],"types":["TINYINT","VARCHAR","VARCHAR"],"nullable":[false,true,true],"key":[[0],[1],[2]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"ANTI","condition":{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"TINYINT"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":0,"type":"TINYINT"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":1,"type":"TINYINT"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}},{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"ANTI","condition":{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"TINYINT"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":0,"type":"TINYINT"}],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":1,"type":"TINYINT"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}],"help":["LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[anti])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n","LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[anti])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAnyInProjectNonNullable.json b/tests/benchmark/testAnyInProjectNonNullable.json new file mode 100644 index 0000000..4ddeb8b --- /dev/null +++ b/tests/benchmark/testAnyInProjectNonNullable.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"> SOME","operand":[{"column":0,"type":"INTEGER"}],"query":{"scan":1},"type":"BOOLEAN"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CAST","operand":[{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"IS TRUE","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":3,"type":"BIGINT"},{"column":4,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<=","operand":[{"column":3,"type":"BIGINT"},{"column":4,"type":"BIGINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BIGINT"},{"column":1,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}],"help":["LogicalProject(NAME=[$1], EXPR$1=[> SOME($0, {\nLogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$1], EXPR$1=[CAST(OR(AND(IS TRUE(>($0, $2)), <>($3, 0)), AND(>($3, $4), null, <>($3, 0), IS NOT TRUE(>($0, $2))), AND(>($0, $2), <>($3, 0), IS NOT TRUE(>($0, $2)), <=($3, $4)))):BOOLEAN NOT NULL])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(m=[$0], c=[$1], d=[$1])\n LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAnyInProjectNullable.json b/tests/benchmark/testAnyInProjectNullable.json new file mode 100644 index 0000000..6ef5953 --- /dev/null +++ b/tests/benchmark/testAnyInProjectNullable.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"IN","operand":[{"column":1,"type":"VARCHAR"}],"query":{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":1}}},"type":"BOOLEAN"}],"source":{"scan":0}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"IS NOT NULL","operand":[{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"<","operand":[{"column":3,"type":"BIGINT"},{"column":2,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"scan":1}}}}}}}]}}}}}}],"help":["LogicalProject(DEPTNO=[$0], EXPR$1=[IN($1, {\nLogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[OR(AND(IS NOT NULL($5), <>($2, 0)), AND(<($3, $2), null, <>($2, 0), IS NULL($5)))])\n LogicalJoin(condition=[=($1, $4)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(MGR=[$3], i=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testBitAndReuseDistinctAttrWithMixedOptionality.json b/tests/benchmark/testBitAndReuseDistinctAttrWithMixedOptionality.json new file mode 100644 index 0000000..e5f1ea8 --- /dev/null +++ b/tests/benchmark/testBitAndReuseDistinctAttrWithMixedOptionality.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"BIT_AND","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"BIT_AND","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[BIT_AND($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT()], EXPR$2=[BIT_AND($0)])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testBitOrReuseDistinctAttrWithMixedOptionality.json b/tests/benchmark/testBitOrReuseDistinctAttrWithMixedOptionality.json new file mode 100644 index 0000000..26b6297 --- /dev/null +++ b/tests/benchmark/testBitOrReuseDistinctAttrWithMixedOptionality.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"BIT_OR","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"BIT_OR","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[BIT_OR($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT()], EXPR$2=[BIT_OR($0)])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testCasePushIsAlwaysWorking.json b/tests/benchmark/testCasePushIsAlwaysWorking.json new file mode 100644 index 0000000..fe300ae --- /dev/null +++ b/tests/benchmark/testCasePushIsAlwaysWorking.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","SAL"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=(CASE(>($1, 1000), $0, $1), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(AND(>($1, 1000), =($0, 1)), =($1, 1))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testCastInAggregateExpandDistinctAggregatesRule.json b/tests/benchmark/testCastInAggregateExpandDistinctAggregatesRule.json new file mode 100644 index 0000000..e479fea --- /dev/null +++ b/tests/benchmark/testCastInAggregateExpandDistinctAggregatesRule.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"BIGINT"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":"CAST","operand":[{"column":1,"type":"BIGINT"}],"type":"BIGINT"},{"operator":"CAST","operand":[{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"BIGINT"},{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"BIGINT"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"},{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BIGINT"},{"column":4,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"BIGINT"},{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"BIGINT"},{"column":3,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":4,"type":"VARCHAR"},{"column":5,"type":"BIGINT"},{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"column":5,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":4,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":5,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM(DISTINCT $1)], EXPR$2=[SUM(DISTINCT $2)])\n LogicalAggregate(group=[{0}], CN=[COUNT()], SM=[SUM($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0], EXPR$1=[CAST($1):BIGINT NOT NULL], EXPR$2=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) FILTER $3], EXPR$2=[SUM($2) FILTER $4])\n LogicalProject(NAME=[$0], CN=[$1], SM=[$2], $g_1=[=($3, 1)], $g_2=[=($3, 2)])\n LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1}, {0, 2}]], $g=[GROUPING($0, $1, $2)])\n LogicalAggregate(group=[{0}], CN=[COUNT()], SM=[SUM($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testCastInAggregateReduceFunctions.json b/tests/benchmark/testCastInAggregateReduceFunctions.json new file mode 100644 index 0000000..5bf87c3 --- /dev/null +++ b/tests/benchmark/testCastInAggregateReduceFunctions.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"STDDEV_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"STDDEV_SAMP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"VAR_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"VAR_SAMP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":"CAST","operand":[{"operator":"POWER","operand":[{"operator":"/","operand":[{"operator":"-","operand":[{"column":1,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"},{"operator":"0.5","operand":[],"type":"DECIMAL"}],"type":"DOUBLE"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"POWER","operand":[{"operator":"/","operand":[{"operator":"-","operand":[{"column":1,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BIGINT"},{"operator":"-","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"operator":"0.5","operand":[],"type":"DECIMAL"}],"type":"DOUBLE"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"-","operand":[{"column":1,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"-","operand":[{"column":1,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BIGINT"},{"operator":"-","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[STDDEV_SAMP($1)], EXPR$4=[VAR_POP($1)], EXPR$5=[VAR_SAMP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0], EXPR$1=[CAST(POWER(/(-($1, /(*($2, $2), $3)), $3), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[CAST(POWER(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1))), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$4=[CAST(/(-($1, /(*($2, $2), $3)), $3)):INTEGER NOT NULL], EXPR$5=[CAST(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1)))):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($2)], agg#1=[$SUM0($1)], agg#2=[COUNT()])\n LogicalProject(NAME=[$0], DEPTNO=[$1], $f2=[*($1, $1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testCustomColumnResolvingInCorrelatedSubQuery.json b/tests/benchmark/testCustomColumnResolvingInCorrelatedSubQuery.json new file mode 100644 index 0000000..643211c --- /dev/null +++ b/tests/benchmark/testCustomColumnResolvingInCorrelatedSubQuery.json @@ -0,0 +1 @@ +{"schemas":[{"name":"T","fields":["\"K0\"","\"C1\"","\"F1\".\"A0\"","\"F2\".\"A0\"","\"F0\".\"C0\"","\"F1\".\"C0\"","\"F0\".\"C1\"","\"F1\".\"C2\"","\"F2\".\"C3\""],"types":["VARCHAR","VARCHAR","INTEGER","BOOLEAN","INTEGER","INTEGER","INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false,false,false,true,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"BOOLEAN"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"operator":"$SCALAR_QUERY","operand":[],"query":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":14,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":9,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":9,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":14,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":9,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"BOOLEAN"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":9,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"VARCHAR"},{"column":14,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":9,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":9,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"VARCHAR"},{"column":14,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}}],"help":["LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[=($4, $SCALAR_QUERY({\nLogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(\"F1\".\"C0\"=[$5])\n LogicalFilter(condition=[=($cor0.\"K0\", $0)])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n","LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[=($4, $9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{0}])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n LogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(\"F1\".\"C0\"=[$1])\n LogicalFilter(condition=[=($cor0.\"K0\", $0)])\n LogicalProject(\"K0\"=[$0], \"F1\".\"C0\"=[$5])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testCustomColumnResolvingInCorrelatedSubQuery2.json b/tests/benchmark/testCustomColumnResolvingInCorrelatedSubQuery2.json new file mode 100644 index 0000000..567cde8 --- /dev/null +++ b/tests/benchmark/testCustomColumnResolvingInCorrelatedSubQuery2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"T","fields":["\"K0\"","\"C1\"","\"F1\".\"A0\"","\"F2\".\"A0\"","\"F0\".\"C0\"","\"F1\".\"C0\"","\"F0\".\"C1\"","\"F1\".\"C2\"","\"F2\".\"C3\""],"types":["VARCHAR","VARCHAR","INTEGER","BOOLEAN","INTEGER","INTEGER","INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false,false,false,true,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"BOOLEAN"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IN","operand":[{"column":4,"type":"INTEGER"}],"query":{"project":{"target":[{"column":14,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"BOOLEAN"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":14,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":11,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":15,"type":"INTEGER"},{"column":17,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}}],"help":["LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[IN($4, {\nLogicalProject(C0=[$5])\n LogicalFilter(condition=[=($cor0.\"F1\".\"C2\", $7)])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n","LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[=($4, $9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n LogicalAggregate(group=[{0}])\n LogicalProject(C0=[$0])\n LogicalFilter(condition=[=($cor0.\"F1\".\"C2\", $1)])\n LogicalProject(\"F1\".\"C0\"=[$5], \"F1\".\"C2\"=[$7])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testCustomColumnResolvingInNonCorrelatedSubQuery.json b/tests/benchmark/testCustomColumnResolvingInNonCorrelatedSubQuery.json new file mode 100644 index 0000000..c07683d --- /dev/null +++ b/tests/benchmark/testCustomColumnResolvingInNonCorrelatedSubQuery.json @@ -0,0 +1 @@ +{"schemas":[{"name":"T","fields":["\"K0\"","\"C1\"","\"F1\".\"A0\"","\"F2\".\"A0\"","\"F0\".\"C0\"","\"F1\".\"C0\"","\"F0\".\"C1\"","\"F1\".\"C2\"","\"F2\".\"C3\""],"types":["VARCHAR","VARCHAR","INTEGER","BOOLEAN","INTEGER","INTEGER","INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false,false,false,true,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"BOOLEAN"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IN","operand":[{"column":4,"type":"INTEGER"}],"query":{"project":{"target":[{"column":14,"type":"INTEGER"}],"source":{"scan":0}}},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"BOOLEAN"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}],"help":["LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[IN($4, {\nLogicalProject(C0=[$5])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n})])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n","LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalJoin(condition=[=($4, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n LogicalAggregate(group=[{0}])\n LogicalProject(C0=[$5])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDecorrelateAggWithConstantGroupKey.json b/tests/benchmark/testDecorrelateAggWithConstantGroupKey.json new file mode 100644 index 0000000..480c79d --- /dev/null +++ b/tests/benchmark/testDecorrelateAggWithConstantGroupKey.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"correlate":[{"scan":0},{"filter":{"condition":{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"project":{"target":[{"column":11,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":10,"type":"CHAR"}],"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"operator":"_ISO-8859-1'abc'","operand":[],"type":"CHAR"},{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":14,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":13,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"column":11,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":10,"type":"CHAR"},{"column":12,"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":13,"type":"INTEGER"},{"operator":"_ISO-8859-1'abc'","operand":[],"type":"CHAR"},{"column":12,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":11,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":18,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":12,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":10,"type":"INTEGER"},{"column":11,"type":"CHAR"}],"source":{"project":{"target":[{"column":12,"type":"INTEGER"},{"operator":"_ISO-8859-1'abc'","operand":[],"type":"CHAR"},{"column":11,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":17,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":14,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":10,"type":"INTEGER"},{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":11,"type":"CHAR"},{"column":13,"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":14,"type":"INTEGER"},{"operator":"_ISO-8859-1'abc'","operand":[],"type":"CHAR"},{"column":13,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":12,"type":"INTEGER"},{"column":17,"type":"INTEGER"},{"column":19,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}}}]}}}}]}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{3, 5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($cor0.SAL, $0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(EXPR$0=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$0=[MAX($2)])\n LogicalProject(DEPTNO=[$2], $f1=['abc'], SAL=[$1])\n LogicalFilter(condition=[=($cor0.MGR, $0)])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[AND(=($3, $10), =($5, $9))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[$2], EMPNO=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$0=[MAX($2)])\n LogicalProject(DEPTNO=[$7], EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDecorrelateExists.json b/tests/benchmark/testDecorrelateExists.json new file mode 100644 index 0000000..75e3981 --- /dev/null +++ b/tests/benchmark/testDecorrelateExists.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"EXISTS","operand":[],"query":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[EXISTS({\nLogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDecorrelateTwoExists.json b/tests/benchmark/testDecorrelateTwoExists.json new file mode 100644 index 0000000..983f5df --- /dev/null +++ b/tests/benchmark/testDecorrelateTwoExists.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"EXISTS","operand":[],"query":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"type":"BOOLEAN"},{"operator":"NOT","operand":[{"operator":"EXISTS","operand":[],"query":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":11,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":14,"type":"INTEGER"},{"operator":"34","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}},"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NULL","operand":[{"column":11,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":10,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},"right":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"34","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"34","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(EXISTS({\nLogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), NOT(EXISTS({\nLogicalFilter(condition=[AND(=($2, $cor0.JOB), =($5, 34))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NULL($11)])\n LogicalJoin(condition=[=($2, $10)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$0], $f1=[true])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$0])\n LogicalFilter(condition=[=($1, 34)])\n LogicalProject(JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDecorrelateTwoIn.json b/tests/benchmark/testDecorrelateTwoIn.json new file mode 100644 index 0000000..071e12b --- /dev/null +++ b/tests/benchmark/testDecorrelateTwoIn.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IN","operand":[{"column":0,"type":"INTEGER"}],"query":{"project":{"target":[{"column":4,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":1}}}}},"type":"BOOLEAN"},{"operator":"IN","operand":[{"column":0,"type":"INTEGER"}],"query":{"project":{"target":[{"column":4,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":7,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}],"help":["LogicalProject(SAL=[$3])\n LogicalFilter(condition=[AND(IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n}), IN($0, {\nLogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=($cor0.ENAME, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(SAL=[$3])\n LogicalJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner])\n LogicalJoin(condition=[AND(=($2, $5), =($0, $4))], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDecorrelateUncorrelatedInAndCorrelatedExists.json b/tests/benchmark/testDecorrelateUncorrelatedInAndCorrelatedExists.json new file mode 100644 index 0000000..2a8f86d --- /dev/null +++ b/tests/benchmark/testDecorrelateUncorrelatedInAndCorrelatedExists.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IN","operand":[{"column":2,"type":"VARCHAR"}],"query":{"project":{"target":[{"column":11,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":14,"type":"INTEGER"},{"operator":"34","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"},{"operator":"EXISTS","operand":[],"query":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":9,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"34","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"34","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(IN($2, {\nLogicalProject(JOB=[$2])\n LogicalFilter(condition=[=($5, 34)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), EXISTS({\nLogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $10)], joinType=[inner])\n LogicalJoin(condition=[=($2, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$0])\n LogicalFilter(condition=[=($1, 34)])\n LogicalProject(JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDigestOfApproximateDistinctAggregateCall.json b/tests/benchmark/testDigestOfApproximateDistinctAggregateCall.json new file mode 100644 index 0000000..a54e438 --- /dev/null +++ b/tests/benchmark/testDigestOfApproximateDistinctAggregateCall.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]},{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}],"help":["LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT(APPROXIMATE DISTINCT $1)])\n LogicalProject(DEPTNO=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalUnion(all=[true])\n LogicalAggregate(group=[{1}], EXPR$1=[COUNT(DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$1=[COUNT(APPROXIMATE DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCount1.json b/tests/benchmark/testDistinctCount1.json new file mode 100644 index 0000000..16dd752 --- /dev/null +++ b/tests/benchmark/testDistinctCount1.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$1], ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])\n LogicalAggregate(group=[{0, 1}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCount2.json b/tests/benchmark/testDistinctCount2.json new file mode 100644 index 0000000..418cb39 --- /dev/null +++ b/tests/benchmark/testDistinctCount2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","SAL","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BIGINT"},{"operator":"CAST","operand":[{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":5,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$2], ENAME=[$0], SAL=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1) FILTER $3], EXPR$2=[MIN($2) FILTER $4])\n LogicalProject(DEPTNO=[$1], ENAME=[$0], EXPR$2=[$2], $g_0=[=($3, 0)], $g_1=[=($3, 1)])\n LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {2}]], EXPR$2=[SUM($1)], $g=[GROUPING($2, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCount3.json b/tests/benchmark/testDistinctCount3.json new file mode 100644 index 0000000..64d8a77 --- /dev/null +++ b/tests/benchmark/testDistinctCount3.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"operator":"CAST","operand":[{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$2])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT(DISTINCT $0)], EXPR$1=[SUM($1)])\n LogicalProject(DEPTNO=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT() FILTER $2], EXPR$1=[MIN($1) FILTER $2])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $g_0=[=($2, 0)])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], $g=[GROUPING($0)])\n LogicalProject(DEPTNO=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountGroupingSets1.json b/tests/benchmark/testDistinctCountGroupingSets1.json new file mode 100644 index 0000000..826d855 --- /dev/null +++ b/tests/benchmark/testDistinctCountGroupingSets1.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB","DEPTNO"],"types":["VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":4,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":5,"type":"INTEGER"},{"column":6,"type":"VARCHAR"},{"column":7,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"VARCHAR"},{"column":7,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":6,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT(DISTINCT $2)])\n LogicalProject(DEPTNO=[$2], JOB=[$1], ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT() FILTER $2])\n LogicalProject(DEPTNO=[$0], JOB=[$1], $g_0=[=($3, 0)])\n LogicalAggregate(group=[{0, 1, 2}], $g=[GROUPING($0, $1, $2)])\n LogicalProject(DEPTNO=[$2], JOB=[$1], ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountGroupingSets2.json b/tests/benchmark/testDistinctCountGroupingSets2.json new file mode 100644 index 0000000..2962122 --- /dev/null +++ b/tests/benchmark/testDistinctCountGroupingSets2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB","SAL","DEPTNO"],"types":["VARCHAR","VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":4,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"BIGINT"},{"operator":"CAST","operand":[{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":4,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":6,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":8,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":5,"type":"INTEGER"},{"column":6,"type":"VARCHAR"},{"column":7,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"VARCHAR"},{"column":7,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT(DISTINCT $2)], EXPR$3=[SUM($3)])\n LogicalProject(DEPTNO=[$3], JOB=[$1], ENAME=[$0], SAL=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], JOB=[$1], EXPR$2=[$2], EXPR$3=[CAST($3):INTEGER NOT NULL])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT($2) FILTER $4], EXPR$3=[MIN($3) FILTER $5])\n LogicalProject(DEPTNO=[$0], JOB=[$1], ENAME=[$2], EXPR$3=[$3], $g_0=[=($4, 0)], $g_1=[=($4, 1)])\n LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1, 2}, {0, 1}]], EXPR$3=[SUM($3)], $g=[GROUPING($0, $1, $2)])\n LogicalProject(DEPTNO=[$3], JOB=[$1], ENAME=[$0], SAL=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountMixed.json b/tests/benchmark/testDistinctCountMixed.json new file mode 100644 index 0000000..16792ff --- /dev/null +++ b/tests/benchmark/testDistinctCountMixed.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","SAL","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BIGINT"},{"operator":"CAST","operand":[{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], CDDJ=[COUNT(DISTINCT $0, $1)], S=[SUM($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], SAL=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], CDDJ=[$1], S=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], CDDJ=[COUNT($1) FILTER $3], S=[MIN($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], JOB=[$1], S=[$2], $g_0=[=($3, 0)], $g_1=[=($3, 1)])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]], S=[SUM($2)], $g=[GROUPING($0, $1)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], SAL=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountMixed2.json b/tests/benchmark/testDistinctCountMixed2.json new file mode 100644 index 0000000..1c9e6c3 --- /dev/null +++ b/tests/benchmark/testDistinctCountMixed2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB","SAL","DEPTNO"],"types":["VARCHAR","VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BIGINT"},{"column":2,"type":"BIGINT"},{"column":3,"type":"BIGINT"},{"operator":"CAST","operand":[{"column":4,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":6,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"},{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":7,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], CDE=[COUNT(DISTINCT $1)], CDJE=[COUNT(DISTINCT $2, $1)], CDDJ=[COUNT(DISTINCT $0, $2)], S=[SUM($3)])\n LogicalProject(DEPTNO=[$3], ENAME=[$0], JOB=[$1], SAL=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], CDE=[$1], CDJE=[$2], CDDJ=[$3], S=[CAST($4):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], CDE=[COUNT($1) FILTER $5], CDJE=[COUNT($2, $1) FILTER $4], CDDJ=[COUNT($2) FILTER $6], S=[MIN($3) FILTER $7])\n LogicalProject(DEPTNO=[$2], ENAME=[$0], JOB=[$1], S=[$3], $g_0=[=($4, 0)], $g_1=[=($4, 1)], $g_2=[=($4, 2)], $g_3=[=($4, 3)])\n LogicalAggregate(group=[{0, 1, 3}], groups=[[{0, 1, 3}, {0, 3}, {1, 3}, {3}]], S=[SUM($2)], $g=[GROUPING($3, $0, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountMixedJoin.json b/tests/benchmark/testDistinctCountMixedJoin.json new file mode 100644 index 0000000..76ee4d7 --- /dev/null +++ b/tests/benchmark/testDistinctCountMixedJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB","SAL","DEPTNO"],"types":["VARCHAR","VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"BIGINT"},{"column":5,"type":"BIGINT"},{"column":7,"type":"BIGINT"},{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"IS NOT DISTINCT FROM","operand":[{"column":0,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"IS NOT DISTINCT FROM","operand":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"IS NOT DISTINCT FROM","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[COUNT(DISTINCT $2, $1)], EXPR$3=[COUNT(DISTINCT $0, $2)], EXPR$4=[SUM($3)])\n LogicalProject(DEPTNO=[$3], ENAME=[$0], JOB=[$1], SAL=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[$3], EXPR$2=[$5], EXPR$3=[$7], EXPR$4=[$1])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $6)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{1}], EXPR$4=[SUM($0)])\n LogicalProject(SAL=[$2], DEPTNO=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(ENAME=[$0], DEPTNO=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{2}], EXPR$2=[COUNT()])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalProject(ENAME=[$0], JOB=[$1], DEPTNO=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$3=[COUNT()])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$1], DEPTNO=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountMultiple.json b/tests/benchmark/testDistinctCountMultiple.json new file mode 100644 index 0000000..2fbbf37 --- /dev/null +++ b/tests/benchmark/testDistinctCountMultiple.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB","DEPTNO"],"types":["VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":5,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":6,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[COUNT(DISTINCT $2)])\n LogicalProject(DEPTNO=[$2], ENAME=[$0], JOB=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1) FILTER $3], EXPR$2=[COUNT($2) FILTER $4])\n LogicalProject(DEPTNO=[$2], ENAME=[$0], JOB=[$1], $g_1=[=($3, 1)], $g_2=[=($3, 2)])\n LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 2}, {1, 2}]], $g=[GROUPING($2, $0, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountMultipleNoGroup.json b/tests/benchmark/testDistinctCountMultipleNoGroup.json new file mode 100644 index 0000000..479faf1 --- /dev/null +++ b/tests/benchmark/testDistinctCountMultipleNoGroup.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB"],"types":["VARCHAR","VARCHAR"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":0,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":1,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":0,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":1,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[COUNT($0) FILTER $2], EXPR$1=[COUNT($1) FILTER $3])\n LogicalProject(ENAME=[$0], JOB=[$1], $g_1=[=($2, 1)], $g_2=[=($2, 2)])\n LogicalAggregate(group=[{0, 1}], groups=[[{0}, {1}]], $g=[GROUPING($0, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountMultipleViaJoin.json b/tests/benchmark/testDistinctCountMultipleViaJoin.json new file mode 100644 index 0000000..76ee4d7 --- /dev/null +++ b/tests/benchmark/testDistinctCountMultipleViaJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB","SAL","DEPTNO"],"types":["VARCHAR","VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"BIGINT"},{"column":5,"type":"BIGINT"},{"column":7,"type":"BIGINT"},{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"IS NOT DISTINCT FROM","operand":[{"column":0,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"IS NOT DISTINCT FROM","operand":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"IS NOT DISTINCT FROM","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[COUNT(DISTINCT $2, $1)], EXPR$3=[COUNT(DISTINCT $0, $2)], EXPR$4=[SUM($3)])\n LogicalProject(DEPTNO=[$3], ENAME=[$0], JOB=[$1], SAL=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[$3], EXPR$2=[$5], EXPR$3=[$7], EXPR$4=[$1])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $6)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{1}], EXPR$4=[SUM($0)])\n LogicalProject(SAL=[$2], DEPTNO=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(ENAME=[$0], DEPTNO=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{2}], EXPR$2=[COUNT()])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalProject(ENAME=[$0], JOB=[$1], DEPTNO=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$3=[COUNT()])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$1], DEPTNO=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountWithExpandSumType.json b/tests/benchmark/testDistinctCountWithExpandSumType.json new file mode 100644 index 0000000..a7930ae --- /dev/null +++ b/tests/benchmark/testDistinctCountWithExpandSumType.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["COMM"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"project":{"target":[{"operator":"CAST","operand":[{"column":0,"type":"DECIMAL"}],"type":"BIGINT"},{"column":1,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":1,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"DECIMAL"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT()], EXPR$1=[COUNT(DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[CAST($0):BIGINT NOT NULL], EXPR$1=[$1])\n LogicalAggregate(group=[{}], EXPR$0=[$SUM0($1)], EXPR$1=[COUNT()])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountWithoutGroupBy.json b/tests/benchmark/testDistinctCountWithoutGroupBy.json new file mode 100644 index 0000000..2ea667e --- /dev/null +++ b/tests/benchmark/testDistinctCountWithoutGroupBy.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":1,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":1,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":0,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":1,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[MAX($0)], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$1], ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[MIN($1) FILTER $3], EXPR$1=[COUNT($0) FILTER $2])\n LogicalProject(ENAME=[$0], EXPR$0=[$1], $g_0=[=($2, 0)], $g_1=[=($2, 1)])\n LogicalAggregate(group=[{0}], groups=[[{0}, {}]], EXPR$0=[MAX($1)], $g=[GROUPING($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctNonDistinctAggregates.json b/tests/benchmark/testDistinctNonDistinctAggregates.json new file mode 100644 index 0000000..9a6a818 --- /dev/null +++ b/tests/benchmark/testDistinctNonDistinctAggregates.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":3,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT()], EXPR$2=[AVG(DISTINCT $1)])\n LogicalProject(EMPNO=[$0], DEPTNO0=[$2])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($2)], EXPR$2=[AVG($1)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT()])\n LogicalProject(EMPNO=[$0], DEPTNO0=[$2])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctNonDistinctAggregatesWithGrouping1.json b/tests/benchmark/testDistinctNonDistinctAggregatesWithGrouping1.json new file mode 100644 index 0000000..d8e0cd1 --- /dev/null +++ b/tests/benchmark/testDistinctNonDistinctAggregatesWithGrouping1.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL","COMM","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($0)], EXPR$2=[SUM(DISTINCT $1)], EXPR$3=[MAX($0)], EXPR$4=[MAX($2)])\n LogicalProject(DEPTNO=[$2], SAL=[$0], COMM=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($2)], EXPR$2=[SUM($1)], EXPR$3=[MAX($3)], EXPR$4=[MAX($4)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM($0)], EXPR$3=[MAX($0)], EXPR$4=[MAX($2)])\n LogicalProject(DEPTNO=[$2], SAL=[$0], COMM=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctNonDistinctAggregatesWithGrouping2.json b/tests/benchmark/testDistinctNonDistinctAggregatesWithGrouping2.json new file mode 100644 index 0000000..ae6997d --- /dev/null +++ b/tests/benchmark/testDistinctNonDistinctAggregatesWithGrouping2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":3,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT()], EXPR$2=[SUM(DISTINCT $1)])\n LogicalProject(DEPTNO=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($2)], EXPR$2=[SUM($1)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT()])\n LogicalProject(DEPTNO=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctNonDistinctTwoAggregatesWithGrouping.json b/tests/benchmark/testDistinctNonDistinctTwoAggregatesWithGrouping.json new file mode 100644 index 0000000..7fc4657 --- /dev/null +++ b/tests/benchmark/testDistinctNonDistinctTwoAggregatesWithGrouping.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL","COMM","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[SUM(DISTINCT $2)])\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($2)], EXPR$2=[MIN($3)], EXPR$3=[SUM($1)])\n LogicalAggregate(group=[{0, 2}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctWithDiffFiltersAndSameGroupSet.json b/tests/benchmark/testDistinctWithDiffFiltersAndSameGroupSet.json new file mode 100644 index 0000000..72c714e --- /dev/null +++ b/tests/benchmark/testDistinctWithDiffFiltersAndSameGroupSet.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"500","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":0,"type":"BOOLEAN"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":1,"type":"BOOLEAN"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"500","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":0,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"source":{"project":{"target":[{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"500","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":2,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":7,"type":"INTEGER"},{"operator":"500","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":0,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"source":{"project":{"target":[{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"500","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":2,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":7,"type":"INTEGER"},{"operator":"500","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT(DISTINCT $0) FILTER $1], EXPR$1=[COUNT(DISTINCT $1) FILTER $0])\n LogicalProject(C=[>($5, 1000)], D=[<($5, 500)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[COUNT() FILTER $1], EXPR$1=[COUNT() FILTER $0])\n LogicalProject($g_0_f_0=[AND(=($2, 0), $0)], $g_0_f_1=[AND(=($2, 0), $1)])\n LogicalAggregate(group=[{0, 1}], $g=[GROUPING($0, $1)])\n LogicalProject(C=[>($5, 1000)], D=[<($5, 500)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctWithFilterAndGroupBy.json b/tests/benchmark/testDistinctWithFilterAndGroupBy.json new file mode 100644 index 0000000..dceb4bc --- /dev/null +++ b/tests/benchmark/testDistinctWithFilterAndGroupBy.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":3,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CAST","operand":[{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BOOLEAN"},{"column":6,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"operator":">","operand":[{"column":8,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":4,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"BOOLEAN"},{"column":7,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":10,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"operator":">","operand":[{"column":9,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT(DISTINCT $2) FILTER $3])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5], $f3=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[CAST($1):INTEGER NOT NULL], EXPR$2=[$2])\n LogicalAggregate(group=[{0}], EXPR$1=[MIN($2) FILTER $4], EXPR$2=[COUNT($1) FILTER $3])\n LogicalProject(DEPTNO=[$0], SAL=[$1], EXPR$1=[$3], $g_0_f_2=[AND(=($4, 0), IS TRUE($2))], $g_3=[=($4, 3)])\n LogicalAggregate(group=[{0, 2, 3}], groups=[[{0, 2, 3}, {0}]], EXPR$1=[SUM($1)], $g=[GROUPING($0, $2, $3)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5], $f3=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctWithFilterWithoutGroupBy.json b/tests/benchmark/testDistinctWithFilterWithoutGroupBy.json new file mode 100644 index 0000000..e8560f1 --- /dev/null +++ b/tests/benchmark/testDistinctWithFilterWithoutGroupBy.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":4,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":4,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT(DISTINCT $1) FILTER $2])\n LogicalProject(COMM=[$6], SAL=[$5], $f2=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[MIN($1) FILTER $3], EXPR$1=[COUNT($0) FILTER $2])\n LogicalProject(SAL=[$0], EXPR$0=[$2], $g_0_f_1=[AND(=($3, 0), IS TRUE($1))], $g_3=[=($3, 3)])\n LogicalAggregate(group=[{1, 2}], groups=[[{1, 2}, {}]], EXPR$0=[SUM($0)], $g=[GROUPING($1, $2)])\n LogicalProject(COMM=[$6], SAL=[$5], $f2=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctWithGrouping.json b/tests/benchmark/testDistinctWithGrouping.json new file mode 100644 index 0000000..6a57cfa --- /dev/null +++ b/tests/benchmark/testDistinctWithGrouping.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL","COMM"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[SUM(DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($2)], EXPR$3=[SUM($0)])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctWithMultipleInputs.json b/tests/benchmark/testDistinctWithMultipleInputs.json new file mode 100644 index 0000000..37f130e --- /dev/null +++ b/tests/benchmark/testDistinctWithMultipleInputs.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL","COMM","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[COUNT(DISTINCT $2, $1)])\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($3)], EXPR$2=[MIN($4)], EXPR$3=[COUNT()])\n LogicalAggregate(group=[{0, 1, 2}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctWithMultipleInputsAndGroupby.json b/tests/benchmark/testDistinctWithMultipleInputsAndGroupby.json new file mode 100644 index 0000000..c3547f4 --- /dev/null +++ b/tests/benchmark/testDistinctWithMultipleInputsAndGroupby.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL","COMM","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":3,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[COUNT(DISTINCT $2, $0, $1)])\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($3)], EXPR$2=[MIN($4)], EXPR$3=[COUNT()])\n LogicalAggregate(group=[{0, 1, 2}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptyAggregate.json b/tests/benchmark/testEmptyAggregate.json new file mode 100644 index 0000000..008c698 --- /dev/null +++ b/tests/benchmark/testEmptyAggregate.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[]}}}}}}]}}}},{"values":{"schema":["INTEGER"],"content":[]}}],"help":["LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[SUM($1)])\n LogicalValues(tuples=[[]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json b/tests/benchmark/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json new file mode 100644 index 0000000..e74a291 --- /dev/null +++ b/tests/benchmark/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"values":{"schema":["INTEGER"],"content":[]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER"],"content":[]}}}}}}]}},{"values":{"schema":["BIGINT","INTEGER"],"content":[[{"operator":"0","operand":[],"type":"BIGINT"},{"operator":"NULL","operand":[],"type":"INTEGER"}]]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT()], EXPR$1=[SUM($0)])\n LogicalValues(tuples=[[]])\n","LogicalValues(tuples=[[{ 0, null }]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptyFilterProjectUnion.json b/tests/benchmark/testEmptyFilterProjectUnion.json new file mode 100644 index 0000000..eb34d81 --- /dev/null +++ b/tests/benchmark/testEmptyFilterProjectUnion.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"20","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}]]}}}}]}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}}],"help":["LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>(+($0, $1), 30)])\n LogicalUnion(all=[true])\n LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 20, 2 }]])\n","LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptyIntersect.json b/tests/benchmark/testEmptyIntersect.json new file mode 100644 index 0000000..450c8cf --- /dev/null +++ b/tests/benchmark/testEmptyIntersect.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"intersect":[{"intersect":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}}}}]},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}}]},{"values":{"schema":["INTEGER","INTEGER"],"content":[]}}],"help":["LogicalIntersect(all=[false])\n LogicalIntersect(all=[false])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 50)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptyMinus.json b/tests/benchmark/testEmptyMinus.json new file mode 100644 index 0000000..1e07111 --- /dev/null +++ b/tests/benchmark/testEmptyMinus.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"distinct":{"except":[{"distinct":{"except":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"20","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}]]}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"40","operand":[],"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}]]}}}}]}},{"values":{"schema":["INTEGER","INTEGER"],"content":[]}}],"help":["LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 30)])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 20, 2 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 40, 4 }]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptyMinus2.json b/tests/benchmark/testEmptyMinus2.json new file mode 100644 index 0000000..1458c81 --- /dev/null +++ b/tests/benchmark/testEmptyMinus2.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"distinct":{"except":[{"distinct":{"except":[{"distinct":{"except":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"20","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}]]}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"40","operand":[],"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}]]}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"50","operand":[],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}]]}}}}}}]}},{"distinct":{"except":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"40","operand":[],"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}]]}}}}]}}],"help":["LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 30)])\n LogicalValues(tuples=[[{ 20, 2 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 40, 4 }]])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 50)])\n LogicalValues(tuples=[[{ 50, 5 }]])\n","LogicalMinus(all=[false])\n LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 40, 4 }]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptyProject.json b/tests/benchmark/testEmptyProject.json new file mode 100644 index 0000000..f913a42 --- /dev/null +++ b/tests/benchmark/testEmptyProject.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"project":{"target":[{"operator":"+","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}}}},{"values":{"schema":["INTEGER"],"content":[]}}],"help":["LogicalProject(EXPR$0=[+(+($0, $1), $0)])\n LogicalFilter(condition=[>(+($0, $1), 50)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptyProject2.json b/tests/benchmark/testEmptyProject2.json new file mode 100644 index 0000000..f913a42 --- /dev/null +++ b/tests/benchmark/testEmptyProject2.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"project":{"target":[{"operator":"+","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}}}},{"values":{"schema":["INTEGER"],"content":[]}}],"help":["LogicalProject(EXPR$0=[+(+($0, $1), $0)])\n LogicalFilter(condition=[>(+($0, $1), 50)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptySort.json b/tests/benchmark/testEmptySort.json new file mode 100644 index 0000000..3ba1e8d --- /dev/null +++ b/tests/benchmark/testEmptySort.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[7,"INTEGER","ASC"]],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}],"help":["LogicalSort(sort0=[$7], dir0=[ASC])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptySort2.json b/tests/benchmark/testEmptySort2.json new file mode 100644 index 0000000..bd3c4b7 --- /dev/null +++ b/tests/benchmark/testEmptySort2.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"sort":{"collation":[[1,"VARCHAR","ASC"],[0,"TINYINT","ASC"]],"source":{"values":{"schema":["TINYINT","VARCHAR","VARCHAR"],"content":[]}}}},{"values":{"schema":["TINYINT","VARCHAR","VARCHAR"],"content":[]}}],"help":["LogicalSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[ASC])\n LogicalValues(tuples=[[]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptySortLimitZero.json b/tests/benchmark/testEmptySortLimitZero.json new file mode 100644 index 0000000..80496b5 --- /dev/null +++ b/tests/benchmark/testEmptySortLimitZero.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[7,"INTEGER","ASC"]],"limit":{"operator":"0","operand":[],"type":"INTEGER"},"source":{"scan":0}}},{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}],"help":["LogicalSort(sort0=[$7], dir0=[ASC], fetch=[0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExistsWithAtLeastOneRowSubQuery.json b/tests/benchmark/testExistsWithAtLeastOneRowSubQuery.json new file mode 100644 index 0000000..83782c6 --- /dev/null +++ b/tests/benchmark/testExistsWithAtLeastOneRowSubQuery.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"EXISTS","operand":[],"query":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}}]}},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"scan":0}],"help":["LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[EXISTS({\nLogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[0])\n LogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExistsWithNoRowSubQuery.json b/tests/benchmark/testExistsWithNoRowSubQuery.json new file mode 100644 index 0000000..8c50aae --- /dev/null +++ b/tests/benchmark/testExistsWithNoRowSubQuery.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"NOT","operand":[{"operator":"EXISTS","operand":[],"query":{"values":{"schema":["BIGINT"],"content":[]}},"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"scan":0}],"help":["LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[NOT(EXISTS({\nLogicalValues(tuples=[[]])\n}))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandFilterExists.json b/tests/benchmark/testExpandFilterExists.json new file mode 100644 index 0000000..cc98e10 --- /dev/null +++ b/tests/benchmark/testExpandFilterExists.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"EXISTS","operand":[],"query":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"type":"BOOLEAN"},{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IS NOT NULL","operand":[{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"}],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($1, 100))])\n LogicalProject(EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IS NOT NULL($2), <($1, 100))])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalProject(EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandFilterExistsSimple.json b/tests/benchmark/testExpandFilterExistsSimple.json new file mode 100644 index 0000000..78a1dd6 --- /dev/null +++ b/tests/benchmark/testExpandFilterExistsSimple.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"EXISTS","operand":[],"query":{"filter":{"condition":{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"}],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}],"help":["LogicalFilter(condition=[EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandFilterExistsSimpleAnd.json b/tests/benchmark/testExpandFilterExistsSimpleAnd.json new file mode 100644 index 0000000..b083004 --- /dev/null +++ b/tests/benchmark/testExpandFilterExistsSimpleAnd.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"EXISTS","operand":[],"query":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"type":"BOOLEAN"},{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"}],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[AND(EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($1, 100))])\n LogicalProject(EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[<($1, 100)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandFilterIn.json b/tests/benchmark/testExpandFilterIn.json new file mode 100644 index 0000000..2c3e187 --- /dev/null +++ b/tests/benchmark/testExpandFilterIn.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IN","operand":[{"column":2,"type":"INTEGER"}],"query":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":3,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"},{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IS NOT NULL","operand":[{"column":4,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IN($2, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($1, 100))])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IS NOT NULL($4), <($1, 100))])\n LogicalJoin(condition=[=($2, $3)], joinType=[left])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$1], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandFilterIn3Value.json b/tests/benchmark/testExpandFilterIn3Value.json new file mode 100644 index 0000000..09bc055 --- /dev/null +++ b/tests/benchmark/testExpandFilterIn3Value.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"operator":"IN","operand":[{"column":1,"type":"INTEGER"}],"query":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":9,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"operator":"IN","operand":[{"column":1,"type":"INTEGER"}],"query":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":9,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"20","operand":[],"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"},{"operator":"IS NOT NULL","operand":[{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":3,"type":"BIGINT"},{"column":2,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"},{"operator":"IS NOT NULL","operand":[{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":3,"type":"BIGINT"},{"column":2,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"20","operand":[],"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BOOLEAN"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[<($0, CASE(=(IN($1, {\nLogicalProject(EXPR$0=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), true), 10, =(IN($1, {\nLogicalProject(EXPR$0=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), false), 20, 30))])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[<($0, CASE(=(CASE(=($2, 0), false, IS NOT NULL($5), true, <($3, $2), null:BOOLEAN, false), true), 10, =(CASE(=($2, 0), false, IS NOT NULL($5), true, <($3, $2), null:BOOLEAN, false), false), 20, 30))])\n LogicalJoin(condition=[=($1, $4)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(EXPR$0=[CASE(true, CAST($1):INTEGER, null:INTEGER)])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(EXPR$0=[CASE(true, CAST($1):INTEGER, null:INTEGER)], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandFilterInComposite.json b/tests/benchmark/testExpandFilterInComposite.json new file mode 100644 index 0000000..b0bbef9 --- /dev/null +++ b/tests/benchmark/testExpandFilterInComposite.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IN","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"query":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":3,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"},{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IS NOT NULL","operand":[{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IN($0, $2, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($1, 100))])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IS NOT NULL($5), <($1, 100))])\n LogicalJoin(condition=[AND(=($0, $3), =($2, $4))], joinType=[left])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], DEPTNO=[$1], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandFilterScalar.json b/tests/benchmark/testExpandFilterScalar.json new file mode 100644 index 0000000..bdde2bb --- /dev/null +++ b/tests/benchmark/testExpandFilterScalar.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"<","operand":[{"operator":"$SCALAR_QUERY","operand":[],"query":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"INTEGER"},{"operator":"$SCALAR_QUERY","operand":[],"query":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"SINGLE_VALUE","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"SINGLE_VALUE","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(<($SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), $SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})), <($1, 100))])\n LogicalProject(EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(<($2, $3), <($1, 100))])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalProject(EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandJoinExists.json b/tests/benchmark/testExpandJoinExists.json new file mode 100644 index 0000000..4984ac3 --- /dev/null +++ b/tests/benchmark/testExpandJoinExists.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"EXISTS","operand":[],"query":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":1}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"}],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], joinType=[left])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandJoinScalar.json b/tests/benchmark/testExpandJoinScalar.json new file mode 100644 index 0000000..d2eb645 --- /dev/null +++ b/tests/benchmark/testExpandJoinScalar.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"<","operand":[{"operator":"$SCALAR_QUERY","operand":[],"query":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"INTEGER"},{"operator":"$SCALAR_QUERY","operand":[],"query":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"join":{"kind":"LEFT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":1}}},"right":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"SINGLE_VALUE","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"SINGLE_VALUE","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[<($SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), $SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], joinType=[left])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[<($2, $3)], joinType=[left])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandProjectExists.json b/tests/benchmark/testExpandProjectExists.json new file mode 100644 index 0000000..97f1f6c --- /dev/null +++ b/tests/benchmark/testExpandProjectExists.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"EXISTS","operand":[],"query":{"filter":{"condition":{"operator":"<","operand":[{"column":9,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"type":"BOOLEAN"}],"source":{"scan":0}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"IS NOT NULL","operand":[{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"}],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}],"help":["LogicalProject(EMPNO=[$0], D=[EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], D=[IS NOT NULL($1)])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandProjectIn.json b/tests/benchmark/testExpandProjectIn.json new file mode 100644 index 0000000..79c2d57 --- /dev/null +++ b/tests/benchmark/testExpandProjectIn.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"IN","operand":[{"column":7,"type":"INTEGER"}],"query":{"project":{"target":[{"column":16,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":9,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"}],"source":{"scan":0}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}],"help":["LogicalProject(EMPNO=[$0], D=[IN($7, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], D=[CASE(IS NOT NULL($3), true, false)])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$1], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandProjectInComposite.json b/tests/benchmark/testExpandProjectInComposite.json new file mode 100644 index 0000000..d54493c --- /dev/null +++ b/tests/benchmark/testExpandProjectInComposite.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"IN","operand":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"query":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":9,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"}],"source":{"scan":0}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"column":4,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], D=[IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], D=[CASE(IS NOT NULL($4), true, false)])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], DEPTNO=[$1], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandProjectInNullable.json b/tests/benchmark/testExpandProjectInNullable.json new file mode 100644 index 0000000..90ce85d --- /dev/null +++ b/tests/benchmark/testExpandProjectInNullable.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"IN","operand":[{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":7,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"query":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":9,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":16,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}},"type":"BOOLEAN"}],"source":{"scan":0}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BOOLEAN"},{"operator":"IS NOT NULL","operand":[{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":3,"type":"BIGINT"},{"column":2,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":7,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":7,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":7,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":9,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}],"help":["LogicalProject(EMPNO=[$0], D=[IN(CASE(true, CAST($7):INTEGER, null:INTEGER), {\nLogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], D=[CASE(=($2, 0), false, IS NULL(CASE(true, CAST($1):INTEGER, null:INTEGER)), null:BOOLEAN, IS NOT NULL($5), true, <($3, $2), null:BOOLEAN, false)])\n LogicalJoin(condition=[=(CASE(true, CAST($1):INTEGER, null:INTEGER), $4)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$1], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandProjectScalar.json b/tests/benchmark/testExpandProjectScalar.json new file mode 100644 index 0000000..4f7e97c --- /dev/null +++ b/tests/benchmark/testExpandProjectScalar.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"$SCALAR_QUERY","operand":[],"query":{"project":{"target":[{"column":16,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":9,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"INTEGER"}],"source":{"scan":0}}},{"join":{"kind":"LEFT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"SINGLE_VALUE","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}],"help":["LogicalProject(EMPNO=[$0], D=[$SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalJoin(condition=[true], joinType=[left])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandWhereComparisonCorrelated.json b/tests/benchmark/testExpandWhereComparisonCorrelated.json new file mode 100644 index 0000000..24ab623 --- /dev/null +++ b/tests/benchmark/testExpandWhereComparisonCorrelated.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"$SCALAR_QUERY","operand":[],"query":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":7,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":7,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":14,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":9,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":14,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=($1, $SCALAR_QUERY({\nLogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(SAL=[$5])\n LogicalFilter(condition=[=($0, $cor0.EMPNO)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalProject(EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=($5, $9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(SAL=[$1])\n LogicalFilter(condition=[=($0, $cor0.EMPNO)])\n LogicalProject(EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpressionSimplification1.json b/tests/benchmark/testExpressionSimplification1.json new file mode 100644 index 0000000..ee84132 --- /dev/null +++ b/tests/benchmark/testExpressionSimplification1.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"<>","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1''","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'3'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":1,"type":"VARCHAR"},{"operator":"Sarg[(-∞.._ISO-8859-1''), (_ISO-8859-1''.._ISO-8859-1'3'), (_ISO-8859-1'3'..+∞)]","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(<>($1, ''), <>($1, '3'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[SEARCH($1, Sarg[(-∞..'':VARCHAR(20)), ('':VARCHAR(20)..'3':VARCHAR(20)), ('3':VARCHAR(20)..+∞)]:VARCHAR(20))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpressionSimplification2.json b/tests/benchmark/testExpressionSimplification2.json new file mode 100644 index 0000000..50803bc --- /dev/null +++ b/tests/benchmark/testExpressionSimplification2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"OR","operand":[{"operator":"<","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1''","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1''","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"OR","operand":[{"operator":"<","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'3'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'3'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":1,"type":"VARCHAR"},{"operator":"Sarg[(-∞.._ISO-8859-1''), (_ISO-8859-1''.._ISO-8859-1'3'), (_ISO-8859-1'3'..+∞)]","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(OR(<($1, ''), >($1, '')), OR(<($1, '3'), >($1, '3')))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[SEARCH($1, Sarg[(-∞..'':CHAR(1)), ('':CHAR(1)..'3'), ('3'..+∞)]:CHAR(1))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExtractJoinFilterRule.json b/tests/benchmark/testExtractJoinFilterRule.json new file mode 100644 index 0000000..28f1d3c --- /dev/null +++ b/tests/benchmark/testExtractJoinFilterRule.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[=($0, $1)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExtractYearMonthToRange.json b/tests/benchmark/testExtractYearMonthToRange.json new file mode 100644 index 0000000..6555a4b --- /dev/null +++ b/tests/benchmark/testExtractYearMonthToRange.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP_B","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER","BIRTHDATE"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN","DATE"],"nullable":[false,false,false,true,false,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"DATE"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"operator":"EXTRACT","operand":[{"operator":"YEAR","operand":[],"type":"SYMBOL"},{"column":9,"type":"DATE"}],"type":"BIGINT"},{"operator":"2014","operand":[],"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"operator":"EXTRACT","operand":[{"operator":"MONTH","operand":[],"type":"SYMBOL"},{"column":9,"type":"DATE"}],"type":"BIGINT"},{"operator":"4","operand":[],"type":"BIGINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"DATE"}],"source":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":9,"type":"DATE"},{"operator":"Sarg[[2014-04-01..2014-05-01)]","operand":[],"type":"DATE"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[AND(=(EXTRACT(FLAG(YEAR), $9), 2014), =(EXTRACT(FLAG(MONTH), $9), 4))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[SEARCH($9, Sarg[[2014-04-01..2014-05-01)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExtractYearToRange.json b/tests/benchmark/testExtractYearToRange.json new file mode 100644 index 0000000..81e2311 --- /dev/null +++ b/tests/benchmark/testExtractYearToRange.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP_B","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER","BIRTHDATE"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN","DATE"],"nullable":[false,false,false,true,false,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"DATE"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"EXTRACT","operand":[{"operator":"YEAR","operand":[],"type":"SYMBOL"},{"column":9,"type":"DATE"}],"type":"BIGINT"},{"operator":"2014","operand":[],"type":"BIGINT"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"DATE"}],"source":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":9,"type":"DATE"},{"operator":"Sarg[[2014-01-01..2015-01-01)]","operand":[],"type":"DATE"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[=(EXTRACT(FLAG(YEAR), $9), 2014)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[SEARCH($9, Sarg[[2014-01-01..2015-01-01)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testFilterJoinRuleAndIsNotNull.json b/tests/benchmark/testFilterJoinRuleAndIsNotNull.json new file mode 100644 index 0000000..7a366da --- /dev/null +++ b/tests/benchmark/testFilterJoinRuleAndIsNotNull.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NOT NULL","operand":[{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT NULL","operand":[{"column":10,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":9,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"column":10,"type":"VARCHAR"}],"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalFilter(condition=[AND(IS NOT NULL($9), IS NOT NULL($10))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[CAST($9):INTEGER], NAME=[CAST($10):VARCHAR(10)])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testFilterJoinRuleOrIsNotNull.json b/tests/benchmark/testFilterJoinRuleOrIsNotNull.json new file mode 100644 index 0000000..45c85fd --- /dev/null +++ b/tests/benchmark/testFilterJoinRuleOrIsNotNull.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IS NOT NULL","operand":[{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT NULL","operand":[{"column":10,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":9,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"column":10,"type":"VARCHAR"}],"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalFilter(condition=[OR(IS NOT NULL($9), IS NOT NULL($10))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[CAST($9):INTEGER], NAME=[CAST($10):VARCHAR(10)])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testFilterProjectTranspose.json b/tests/benchmark/testFilterProjectTranspose.json new file mode 100644 index 0000000..973054f --- /dev/null +++ b/tests/benchmark/testFilterProjectTranspose.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":9,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"*","operand":[{"column":9,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":9,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"*","operand":[{"column":9,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}]}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":9,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"*","operand":[{"column":9,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":9,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"*","operand":[{"column":9,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}]}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalProject(TWICEDEPTNO=[*($0, 2)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, *($0, 2))])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testFilterRemoveIsNotDistinctFromRule.json b/tests/benchmark/testFilterRemoveIsNotDistinctFromRule.json new file mode 100644 index 0000000..a5a813d --- /dev/null +++ b/tests/benchmark/testFilterRemoveIsNotDistinctFromRule.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO"],"types":["SMALLINT","VARCHAR","VARCHAR","SMALLINT","DATE","DECIMAL","DECIMAL","TINYINT"],"nullable":[false,true,true,true,true,true,true,true],"key":[[0],[1]],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"IS NOT DISTINCT FROM","operand":[{"column":7,"type":"TINYINT"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"TINYINT"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}],"help":["LogicalFilter(condition=[IS NOT DISTINCT FROM($7, 20)])\n LogicalTableScan(table=[[scott, EMP]])\n","LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[scott, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testFlattenUncorrelatedCallBelowEquals.json b/tests/benchmark/testFlattenUncorrelatedCallBelowEquals.json new file mode 100644 index 0000000..1dcd63a --- /dev/null +++ b/tests/benchmark/testFlattenUncorrelatedCallBelowEquals.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":9,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"column":9,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":9,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"column":9,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":9,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"+","operand":[{"column":16,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":9,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"+","operand":[{"column":16,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, +($0, 30))])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalProject($f9=[+($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json b/tests/benchmark/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json new file mode 100644 index 0000000..e6b1cf9 --- /dev/null +++ b/tests/benchmark/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":9,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":9,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":9,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"+","operand":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":9,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"+","operand":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, +(*(2, $0), 30))])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalProject($f9=[+(*(2, $7), 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testFullOuterJoinSimplificationToInner.json b/tests/benchmark/testFullOuterJoinSimplificationToInner.json new file mode 100644 index 0000000..5e1aa09 --- /dev/null +++ b/tests/benchmark/testFullOuterJoinSimplificationToInner.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[AND(=($1, 'Charlie'), >($2, 100))])\n LogicalJoin(condition=[=($0, $3)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testFullOuterJoinSimplificationToLeftOuter.json b/tests/benchmark/testFullOuterJoinSimplificationToLeftOuter.json new file mode 100644 index 0000000..bdbd37e --- /dev/null +++ b/tests/benchmark/testFullOuterJoinSimplificationToLeftOuter.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalJoin(condition=[=($0, $2)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testFullOuterJoinSimplificationToRightOuter.json b/tests/benchmark/testFullOuterJoinSimplificationToRightOuter.json new file mode 100644 index 0000000..371f13f --- /dev/null +++ b/tests/benchmark/testFullOuterJoinSimplificationToRightOuter.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($1, 100)])\n LogicalJoin(condition=[=($0, $2)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testGroupByBooleanLiteralSimple.json b/tests/benchmark/testGroupByBooleanLiteralSimple.json new file mode 100644 index 0000000..e5c5c62 --- /dev/null +++ b/tests/benchmark/testGroupByBooleanLiteralSimple.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"}],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":1,"type":"BOOLEAN"},{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"values":{"schema":["BOOLEAN"],"content":[[{"operator":"true","operand":[],"type":"BOOLEAN"}]]}}}}}}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"BOOLEAN"},{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"values":{"schema":["BOOLEAN"],"content":[[{"operator":"true","operand":[],"type":"BOOLEAN"}]]}}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[true], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[$1], SAL=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[{ true }]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testGroupByDateLiteralSimple.json b/tests/benchmark/testGroupByDateLiteralSimple.json new file mode 100644 index 0000000..97fed96 --- /dev/null +++ b/tests/benchmark/testGroupByDateLiteralSimple.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"DATE"}],"source":{"project":{"target":[{"operator":"java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]","operand":[],"type":"DATE"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"DATE"},{"column":1,"type":"DATE"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]","operand":[],"type":"DATE"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"DATE"}],"source":{"project":{"target":[{"column":1,"type":"DATE"},{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"values":{"schema":["DATE"],"content":[[{"operator":"java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]","operand":[],"type":"DATE"}]]}}}}}}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"DATE"},{"column":1,"type":"DATE"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"DATE"},{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"values":{"schema":["DATE"],"content":[[{"operator":"java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]","operand":[],"type":"DATE"}]]}}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[2022-01-01], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[$1], SAL=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[{ 2022-01-01 }]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testGroupByMultipleLiterals.json b/tests/benchmark/testGroupByMultipleLiterals.json new file mode 100644 index 0000000..ea0b901 --- /dev/null +++ b/tests/benchmark/testGroupByMultipleLiterals.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":6,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BOOLEAN"},{"column":3,"type":"INTEGER"},{"column":4,"type":"CHAR"},{"column":5,"type":"DATE"}],"source":{"project":{"target":[{"operator":"false","operand":[],"type":"BOOLEAN"},{"column":7,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"column":0,"type":"INTEGER"},{"operator":"_ISO-8859-1'ab'","operand":[],"type":"CHAR"},{"operator":"java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]","operand":[],"type":"DATE"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":12,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":6,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BOOLEAN"},{"column":8,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"CHAR"},{"column":10,"type":"CHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"DATE"},{"column":11,"type":"DATE"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"false","operand":[],"type":"BOOLEAN"},{"column":13,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"column":6,"type":"INTEGER"},{"operator":"_ISO-8859-1'ab'","operand":[],"type":"CHAR"},{"operator":"java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]","operand":[],"type":"DATE"},{"column":11,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":6,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BOOLEAN"},{"column":3,"type":"INTEGER"},{"column":4,"type":"CHAR"},{"column":5,"type":"DATE"}],"source":{"project":{"target":[{"column":3,"type":"BOOLEAN"},{"column":2,"type":"INTEGER"},{"column":4,"type":"BOOLEAN"},{"column":0,"type":"INTEGER"},{"column":5,"type":"CHAR"},{"column":6,"type":"DATE"},{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"values":{"schema":["BOOLEAN","BOOLEAN","CHAR","DATE"],"content":[[{"operator":"false","operand":[],"type":"BOOLEAN"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'ab'","operand":[],"type":"CHAR"},{"operator":"java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]","operand":[],"type":"DATE"}]]}}}}}}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":12,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":6,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BOOLEAN"},{"column":8,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"CHAR"},{"column":10,"type":"CHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"DATE"},{"column":11,"type":"DATE"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"BOOLEAN"},{"column":8,"type":"INTEGER"},{"column":10,"type":"BOOLEAN"},{"column":6,"type":"INTEGER"},{"column":11,"type":"CHAR"},{"column":12,"type":"DATE"},{"column":7,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":11,"type":"INTEGER"},{"column":13,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"values":{"schema":["BOOLEAN","BOOLEAN","CHAR","DATE"],"content":[[{"operator":"false","operand":[],"type":"BOOLEAN"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'ab'","operand":[],"type":"CHAR"},{"operator":"java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]","operand":[],"type":"DATE"}]]}}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$6])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5}], EXPR$0=[AVG($6)])\n LogicalProject($f0=[false], DEPTNO=[$7], $f2=[true], EMPNO=[$0], $f4=['ab'], $f5=[2022-01-01], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$6])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5}], EXPR$0=[AVG($6)])\n LogicalProject($f0=[$3], DEPTNO=[$2], $f2=[$4], EMPNO=[$0], $f4=[$5], $f5=[$6], SAL=[$1])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[{ false, true, 'ab', 2022-01-01 }]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testInferringPredicatesWithNotOperatorInJoinCondition.json b/tests/benchmark/testInferringPredicatesWithNotOperatorInJoinCondition.json new file mode 100644 index 0000000..9902278 --- /dev/null +++ b/tests/benchmark/testInferringPredicatesWithNotOperatorInJoinCondition.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":16,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NOT","operand":[{"operator":"OR","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"6","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":16,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"NOT","operand":[{"operator":"OR","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"6","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":7,"type":"INTEGER"},{"operator":"Sarg[(-∞..4), (4..6), (6..+∞)]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[AND(=($16, $7), NOT(OR(=($7, 4), =($7, 6))))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[=($16, $7)], joinType=[inner])\n LogicalFilter(condition=[NOT(OR(=($7, 4), =($7, 6)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[SEARCH($7, Sarg[(-∞..4), (4..6), (6..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testIntersectToDistinct.json b/tests/benchmark/testIntersectToDistinct.json new file mode 100644 index 0000000..8960543 --- /dev/null +++ b/tests/benchmark/testIntersectToDistinct.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"intersect":[{"intersect":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"3","operand":[],"type":"BIGINT"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":10,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"TIMESTAMP"},{"column":13,"type":"TIMESTAMP"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"column":14,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":6,"type":"INTEGER"},{"column":15,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":8,"type":"BOOLEAN"},{"column":17,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":16,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":16,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":16,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}]}}}}}}],"help":["LogicalIntersect(all=[false])\n LogicalIntersect(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($9, 3)])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5, 6, 7, 8}], agg#0=[COUNT()])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testIsNullPushDown.json b/tests/benchmark/testIsNullPushDown.json new file mode 100644 index 0000000..25601c4 --- /dev/null +++ b/tests/benchmark/testIsNullPushDown.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"values":{"schema":["INTEGER","INTEGER","BIGINT"],"content":[]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"source":{"values":{"schema":["INTEGER","INTEGER","BIGINT"],"content":[]}}}}],"help":["LogicalValues(tuples=[[]])\n","LogicalProject(EMPNO=[$0], DEPTNO=[$1], W_COUNT=[$2])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testIsNullPushDown2.json b/tests/benchmark/testIsNullPushDown2.json new file mode 100644 index 0000000..25601c4 --- /dev/null +++ b/tests/benchmark/testIsNullPushDown2.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"values":{"schema":["INTEGER","INTEGER","BIGINT"],"content":[]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"source":{"values":{"schema":["INTEGER","INTEGER","BIGINT"],"content":[]}}}}],"help":["LogicalValues(tuples=[[]])\n","LogicalProject(EMPNO=[$0], DEPTNO=[$1], W_COUNT=[$2])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json b/tests/benchmark/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json new file mode 100644 index 0000000..064ba09 --- /dev/null +++ b/tests/benchmark/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO"],"types":["SMALLINT","VARCHAR","VARCHAR","SMALLINT","DATE","DECIMAL","DECIMAL","TINYINT"],"nullable":[false,true,true,true,true,true,true,true],"key":[[0],[1]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","DNAME","LOC"],"types":["TINYINT","VARCHAR","VARCHAR"],"nullable":[false,true,true],"key":[[0],[1],[2]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME","JOB","SAL","COMM"],"types":["VARCHAR","VARCHAR","DECIMAL","DECIMAL"],"nullable":[true,true,true,true],"key":[[0],[1],[2],[3]],"foreign":[],"guaranteed":[]}],"queries":[{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":12,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"TINYINT"},{"column":8,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":2}}},{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":12,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"TINYINT"},{"column":8,"type":"TINYINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":1},"right":{"scan":2}}}}}],"help":["LogicalJoin(condition=[=($2, $12)], joinType=[inner])\n LogicalJoin(condition=[=($7, $8)], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, BONUS]])\n","LogicalJoin(condition=[AND(=($2, $12), =($7, $8))], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json b/tests/benchmark/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json new file mode 100644 index 0000000..386c5a5 --- /dev/null +++ b/tests/benchmark/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO"],"types":["SMALLINT","VARCHAR","VARCHAR","SMALLINT","DATE","DECIMAL","DECIMAL","TINYINT"],"nullable":[false,true,true,true,true,true,true,true],"key":[[0],[1]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME","JOB","SAL","COMM"],"types":["VARCHAR","VARCHAR","DECIMAL","DECIMAL"],"nullable":[true,true,true,true],"key":[[0],[1],[2],[3]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","DNAME","LOC"],"types":["TINYINT","VARCHAR","VARCHAR"],"nullable":[false,true,true],"key":[[0],[1],[2]],"foreign":[],"guaranteed":[]}],"queries":[{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"TINYINT"},{"column":12,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":2}}},{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"TINYINT"},{"column":12,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":1},"right":{"scan":2}}}}}],"help":["LogicalJoin(condition=[=($7, $12)], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, BONUS]])\n LogicalTableScan(table=[[scott, DEPT]])\n","LogicalJoin(condition=[=($7, $12)], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, BONUS]])\n LogicalTableScan(table=[[scott, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json b/tests/benchmark/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json new file mode 100644 index 0000000..e89741a --- /dev/null +++ b/tests/benchmark/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO"],"types":["SMALLINT","VARCHAR","VARCHAR","SMALLINT","DATE","DECIMAL","DECIMAL","TINYINT"],"nullable":[false,true,true,true,true,true,true,true],"key":[[0],[1]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","DNAME","LOC"],"types":["TINYINT","VARCHAR","VARCHAR"],"nullable":[false,true,true],"key":[[0],[1],[2]],"foreign":[],"guaranteed":[]}],"queries":[{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},{"project":{"target":[{"column":3,"type":"SMALLINT"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"},{"column":6,"type":"SMALLINT"},{"column":7,"type":"DATE"},{"column":8,"type":"DECIMAL"},{"column":9,"type":"DECIMAL"},{"column":10,"type":"TINYINT"},{"column":0,"type":"TINYINT"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":1},"right":{"scan":0}}}}}],"help":["LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, DEPT]])\n","LogicalProject(EMPNO=[$3], ENAME=[$4], JOB=[$5], MGR=[$6], HIREDATE=[$7], SAL=[$8], COMM=[$9], DEPTNO=[$10], DEPTNO0=[$0], DNAME=[$1], LOC=[$2])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinConditionPushdown1.json b/tests/benchmark/testJoinConditionPushdown1.json new file mode 100644 index 0000000..09eb1ad --- /dev/null +++ b/tests/benchmark/testJoinConditionPushdown1.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"},{"column":18,"type":"INTEGER"},{"column":19,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":18,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":16,"type":"INTEGER"},{"column":18,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"},{"column":18,"type":"INTEGER"},{"column":19,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":18,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17], DEPTNO1=[$18], NAME=[$19])\n LogicalFilter(condition=[AND(=($7, $18), =($16, $18))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17], DEPTNO1=[$18], NAME=[$19])\n LogicalJoin(condition=[=($7, $18)], joinType=[inner])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinConditionPushdown2.json b/tests/benchmark/testJoinConditionPushdown2.json new file mode 100644 index 0000000..51137f1 --- /dev/null +++ b/tests/benchmark/testJoinConditionPushdown2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalFilter(condition=[AND(=($7, $9), =($0, $9))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalFilter(condition=[=($7, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinConditionPushdown4.json b/tests/benchmark/testJoinConditionPushdown4.json new file mode 100644 index 0000000..4a213b9 --- /dev/null +++ b/tests/benchmark/testJoinConditionPushdown4.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["SMALLINT","TINYINT"],"nullable":[false,true],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","DNAME"],"types":["TINYINT","VARCHAR"],"nullable":[false,true],"key":[[0],[1]],"foreign":[],"guaranteed":[]}],"queries":[{"join":{"kind":"SEMI","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":1,"type":"TINYINT"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"TINYINT"}],"source":{"scan":0}}},"right":{"scan":1}}},{"project":{"target":[{"column":1,"type":"TINYINT"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":1,"type":"TINYINT"},{"column":2,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}],"help":["LogicalJoin(condition=[AND(=($0, $1), =($0, $2))], joinType=[semi])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, DEPT]])\n","LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalFilter(condition=[=($0, $1)])\n LogicalTableScan(table=[[scott, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinConditionPushdown6.json b/tests/benchmark/testJoinConditionPushdown6.json new file mode 100644 index 0000000..8c5a1e2 --- /dev/null +++ b/tests/benchmark/testJoinConditionPushdown6.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[AND(=($7, $9), =($0, $9))], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalFilter(condition=[=($7, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinDeriveIsNotNullFilterRule1.json b/tests/benchmark/testJoinDeriveIsNotNullFilterRule1.json new file mode 100644 index 0000000..2798dac --- /dev/null +++ b/tests/benchmark/testJoinDeriveIsNotNullFilterRule1.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["MGR","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[true,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(MGR=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalProject(MGR=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinDeriveIsNotNullFilterRule12.json b/tests/benchmark/testJoinDeriveIsNotNullFilterRule12.json new file mode 100644 index 0000000..c676120 --- /dev/null +++ b/tests/benchmark/testJoinDeriveIsNotNullFilterRule12.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMPNULLABLES","fields":["ENAME","MGR","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[true,true,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"IS NOT DISTINCT FROM","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"IS NOT DISTINCT FROM","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(DEPTNO=[$2])\n LogicalJoin(condition=[AND(=($0, $3), IS NOT DISTINCT FROM($1, $4))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalProject(ENAME=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n","LogicalProject(DEPTNO=[$2])\n LogicalJoin(condition=[AND(=($0, $3), IS NOT DISTINCT FROM($1, $4))], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalProject(ENAME=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinDeriveIsNotNullFilterRule2.json b/tests/benchmark/testJoinDeriveIsNotNullFilterRule2.json new file mode 100644 index 0000000..745a383 --- /dev/null +++ b/tests/benchmark/testJoinDeriveIsNotNullFilterRule2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["MGR","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[true,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(MGR=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalProject(MGR=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinDeriveIsNotNullFilterRule3.json b/tests/benchmark/testJoinDeriveIsNotNullFilterRule3.json new file mode 100644 index 0000000..4706a91 --- /dev/null +++ b/tests/benchmark/testJoinDeriveIsNotNullFilterRule3.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["MGR","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[true,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[>($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(MGR=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[>($0, $2)], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalProject(MGR=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinDeriveIsNotNullFilterRule4.json b/tests/benchmark/testJoinDeriveIsNotNullFilterRule4.json new file mode 100644 index 0000000..7ad5aad --- /dev/null +++ b/tests/benchmark/testJoinDeriveIsNotNullFilterRule4.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMPNULLABLES","fields":["ENAME","MGR","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[true,true,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NOT NULL","operand":[{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"IS NOT NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NOT NULL","operand":[{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"IS NOT NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(DEPTNO=[$2])\n LogicalJoin(condition=[AND(=($0, $3), >($1, $4))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalProject(ENAME=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n","LogicalProject(DEPTNO=[$2])\n LogicalJoin(condition=[AND(=($0, $3), >($1, $4))], joinType=[inner])\n LogicalFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])\n LogicalProject(ENAME=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinDeriveIsNotNullFilterRule5.json b/tests/benchmark/testJoinDeriveIsNotNullFilterRule5.json new file mode 100644 index 0000000..4e642c7 --- /dev/null +++ b/tests/benchmark/testJoinDeriveIsNotNullFilterRule5.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMPNULLABLES","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[true,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$0], DEPTNO=[+($1, 1)])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n","LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$0], DEPTNO=[+($1, 1)])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinProjectTranspose1.json b/tests/benchmark/testJoinProjectTranspose1.json new file mode 100644 index 0000000..3fa042a --- /dev/null +++ b/tests/benchmark/testJoinProjectTranspose1.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"column":1,"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"column":1,"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"project":{"target":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}],"help":["LogicalProject(NAME=[$0])\n LogicalJoin(condition=[$1], joinType=[right])\n LogicalProject(NAME=[$0], $f4=[$2])\n LogicalJoin(condition=[$1], joinType=[left])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject($f2=[>($0, 10)], $f4=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0])\n LogicalJoin(condition=[>($1, 10)], joinType=[right])\n LogicalJoin(condition=[>($1, 10)], joinType=[left])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinProjectTranspose7.json b/tests/benchmark/testJoinProjectTranspose7.json new file mode 100644 index 0000000..64cc274 --- /dev/null +++ b/tests/benchmark/testJoinProjectTranspose7.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}}],"help":["LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinProjectTranspose8.json b/tests/benchmark/testJoinProjectTranspose8.json new file mode 100644 index 0000000..aa419d3 --- /dev/null +++ b/tests/benchmark/testJoinProjectTranspose8.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}}}}],"help":["LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$2], EXPR$1=[$3])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], EXPR$1=[AND(>($0, 10), null)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$2], EXPR$1=[$3])\n LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$3], EXPR$1=[AND(>($2, 10), null)])\n LogicalJoin(condition=[=($1, $3)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinProjectTransposeWindow.json b/tests/benchmark/testJoinProjectTransposeWindow.json new file mode 100644 index 0000000..57b8d48 --- /dev/null +++ b/tests/benchmark/testJoinProjectTransposeWindow.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"BIGINT"},{"column":4,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"operator":"CAST","operand":[{"column":1,"type":"VARCHAR"}],"type":"BIGINT"}],"source":{"scan":0}}},"right":{"project":{"target":[{"error":"Not implemented: RANK"},{"operator":"+","operand":[{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"operator":"CAST","operand":[{"column":1,"type":"VARCHAR"}],"type":"BIGINT"},{"column":2,"type":"BIGINT"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"error":"Not implemented: RANK"},{"operator":"+","operand":[{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}],"help":["LogicalProject(DEPTNO=[$0], NAME=[$1], R=[$3], EXPR$1=[$4])\n LogicalJoin(condition=[=($2, $3)], joinType=[inner])\n LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[CAST($1):BIGINT NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(R=[RANK() OVER (ORDER BY $1)], EXPR$1=[+(1, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalJoin(condition=[=(CAST($1):BIGINT NOT NULL, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(R=[RANK() OVER (ORDER BY $1)], EXPR$1=[+(1, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinPushTransitivePredicatesRule2.json b/tests/benchmark/testJoinPushTransitivePredicatesRule2.json new file mode 100644 index 0000000..7e8c1b5 --- /dev/null +++ b/tests/benchmark/testJoinPushTransitivePredicatesRule2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMPNULLABLES","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[true,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":4,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"OR","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BOOLEAN"},{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"OR","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":4,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BOOLEAN"},{"column":6,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":6,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}}}}]}}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":4,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},"right":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"OR","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BOOLEAN"},{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"OR","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":4,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BOOLEAN"},{"column":6,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":6,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}}}}]}}}}}}}}],"help":["LogicalProject(SAL=[$0])\n LogicalJoin(condition=[AND(=($0, $3), =($1, $4))], joinType=[inner])\n LogicalProject(SAL=[$0], $f9=[=($0, 4)])\n LogicalFilter(condition=[AND(=($1, 20), >($0, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[=($1, $0)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalJoin(condition=[OR(=($1, $0), $2)], joinType=[inner])\n LogicalProject(SAL=[$0])\n LogicalFilter(condition=[AND(=($1, 20), >($0, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(SAL=[$0], $f9=[=($0, 4)])\n LogicalFilter(condition=[AND(=($1, 20), >($0, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n","LogicalProject(SAL=[$0])\n LogicalJoin(condition=[AND(=($0, $3), =($1, $4))], joinType=[inner])\n LogicalFilter(condition=[>($0, 1000)])\n LogicalProject(SAL=[$0], $f9=[=($0, 4)])\n LogicalFilter(condition=[AND(=($1, 20), >($0, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[=($1, $0)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalJoin(condition=[OR(=($1, $0), $2)], joinType=[inner])\n LogicalProject(SAL=[$0])\n LogicalFilter(condition=[AND(=($1, 20), >($0, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(SAL=[$0], $f9=[=($0, 4)])\n LogicalFilter(condition=[AND(=($1, 20), >($0, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testLeftEmptyAntiJoin.json b/tests/benchmark/testLeftEmptyAntiJoin.json new file mode 100644 index 0000000..b6688d1 --- /dev/null +++ b/tests/benchmark/testLeftEmptyAntiJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["TINYINT"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"join":{"kind":"ANTI","condition":{"operator":"=","operand":[{"column":7,"type":"TINYINT"},{"column":8,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"values":{"schema":["SMALLINT","VARCHAR","VARCHAR","SMALLINT","DATE","DECIMAL","DECIMAL","TINYINT"],"content":[]}},"right":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"values":{"schema":["SMALLINT","VARCHAR","VARCHAR","SMALLINT","DATE","DECIMAL","DECIMAL","TINYINT"],"content":[]}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($7, $8)], joinType=[anti])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[scott, DEPT]])\n","LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testLeftEmptyFullJoin.json b/tests/benchmark/testLeftEmptyFullJoin.json new file mode 100644 index 0000000..ad1ee5d --- /dev/null +++ b/tests/benchmark/testLeftEmptyFullJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}},"right":{"scan":1}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testLeftEmptyInnerJoin.json b/tests/benchmark/testLeftEmptyInnerJoin.json new file mode 100644 index 0000000..b585118 --- /dev/null +++ b/tests/benchmark/testLeftEmptyInnerJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN","INTEGER","VARCHAR"],"content":[]}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testLeftEmptyLeftJoin.json b/tests/benchmark/testLeftEmptyLeftJoin.json new file mode 100644 index 0000000..330534a --- /dev/null +++ b/tests/benchmark/testLeftEmptyLeftJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN","INTEGER","VARCHAR"],"content":[]}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testLeftEmptyRightJoin.json b/tests/benchmark/testLeftEmptyRightJoin.json new file mode 100644 index 0000000..8fd8c69 --- /dev/null +++ b/tests/benchmark/testLeftEmptyRightJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}},"right":{"scan":1}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testLeftEmptySemiJoin.json b/tests/benchmark/testLeftEmptySemiJoin.json new file mode 100644 index 0000000..403953a --- /dev/null +++ b/tests/benchmark/testLeftEmptySemiJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["TINYINT"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":7,"type":"TINYINT"},{"column":8,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"values":{"schema":["SMALLINT","VARCHAR","VARCHAR","SMALLINT","DATE","DECIMAL","DECIMAL","TINYINT"],"content":[]}},"right":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"values":{"schema":["SMALLINT","VARCHAR","VARCHAR","SMALLINT","DATE","DECIMAL","DECIMAL","TINYINT"],"content":[]}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($7, $8)], joinType=[semi])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[scott, DEPT]])\n","LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testLeftOuterJoinSimplificationToInner.json b/tests/benchmark/testLeftOuterJoinSimplificationToInner.json new file mode 100644 index 0000000..5303e35 --- /dev/null +++ b/tests/benchmark/testLeftOuterJoinSimplificationToInner.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($1, 100)])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMaxReuseDistinctAttrWithMixedOptionality.json b/tests/benchmark/testMaxReuseDistinctAttrWithMixedOptionality.json new file mode 100644 index 0000000..e08a9a9 --- /dev/null +++ b/tests/benchmark/testMaxReuseDistinctAttrWithMixedOptionality.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MAX","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MAX","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[MAX($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT()], EXPR$2=[MAX($0)])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMergeFilter.json b/tests/benchmark/testMergeFilter.json new file mode 100644 index 0000000..b5b1fb3 --- /dev/null +++ b/tests/benchmark/testMergeFilter.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}},{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(NAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMergeIntersect.json b/tests/benchmark/testMergeIntersect.json new file mode 100644 index 0000000..e7bdce7 --- /dev/null +++ b/tests/benchmark/testMergeIntersect.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"intersect":[{"intersect":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]},{"intersect":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}],"help":["LogicalIntersect(all=[false])\n LogicalIntersect(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalIntersect(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMergeJoinFilter.json b/tests/benchmark/testMergeJoinFilter.json new file mode 100644 index 0000000..1b283d3 --- /dev/null +++ b/tests/benchmark/testMergeJoinFilter.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}],"help":["LogicalFilter(condition=[=($0, 10)])\n LogicalProject(DEPTNO=[$2], ENAME=[$0])\n LogicalJoin(condition=[AND(=($1, $2), =($2, 10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(DEPTNO=[$2], ENAME=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMergeMinus.json b/tests/benchmark/testMergeMinus.json new file mode 100644 index 0000000..f6a051d --- /dev/null +++ b/tests/benchmark/testMergeMinus.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"except":[{"distinct":{"except":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"except":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalMinus(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMergeUnionAll.json b/tests/benchmark/testMergeUnionAll.json new file mode 100644 index 0000000..d340e3c --- /dev/null +++ b/tests/benchmark/testMergeUnionAll.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"union":[{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]},{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}],"help":["LogicalUnion(all=[true])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMergeUnionDistinct.json b/tests/benchmark/testMergeUnionDistinct.json new file mode 100644 index 0000000..710d04d --- /dev/null +++ b/tests/benchmark/testMergeUnionDistinct.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"union":[{"distinct":{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalUnion(all=[false])\n LogicalUnion(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalUnion(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMergeUnionMixed2.json b/tests/benchmark/testMergeUnionMixed2.json new file mode 100644 index 0000000..91a8095 --- /dev/null +++ b/tests/benchmark/testMergeUnionMixed2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"union":[{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalUnion(all=[false])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalUnion(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMinReuseDistinctAttrWithMixedOptionality.json b/tests/benchmark/testMinReuseDistinctAttrWithMixedOptionality.json new file mode 100644 index 0000000..8d191d6 --- /dev/null +++ b/tests/benchmark/testMinReuseDistinctAttrWithMixedOptionality.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[MIN($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT()], EXPR$2=[MIN($0)])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMinusMergeRule.json b/tests/benchmark/testMinusMergeRule.json new file mode 100644 index 0000000..967fee5 --- /dev/null +++ b/tests/benchmark/testMinusMergeRule.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"except":[{"except":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"except":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"except":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}]},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}]},{"except":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"except":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}]},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}]}],"help":["LogicalMinus(all=[true])\n LogicalMinus(all=[true])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalMinus(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0], EXPR$2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalMinus(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0], EXPR$2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalMinus(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalMinus(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMultipleDistinctWithGrouping.json b/tests/benchmark/testMultipleDistinctWithGrouping.json new file mode 100644 index 0000000..a13a400 --- /dev/null +++ b/tests/benchmark/testMultipleDistinctWithGrouping.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL","COMM"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"IS NOT DISTINCT FROM","operand":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"IS NOT DISTINCT FROM","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[AVG(DISTINCT $1)], EXPR$3=[SUM(DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(SAL=[$0], EXPR$1=[$1], EXPR$2=[$3], EXPR$3=[$5])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$2=[AVG($1)])\n LogicalAggregate(group=[{0, 1}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$3=[SUM($0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testNoOversimplificationBelowIsNull.json b/tests/benchmark/testNoOversimplificationBelowIsNull.json new file mode 100644 index 0000000..f688511 --- /dev/null +++ b/tests/benchmark/testNoOversimplificationBelowIsNull.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NULL","operand":[{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NULL","operand":[{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"NULL","operand":[],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NULL(OR(AND(=($0, 1), =($3, 1)), AND(=($0, null), =($3, 1))))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NULL(OR(AND(=($0, 1), =($3, 1)), AND(null, =($3, 1))))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testOrAlwaysTrue.json b/tests/benchmark/testOrAlwaysTrue.json new file mode 100644 index 0000000..702d373 --- /dev/null +++ b/tests/benchmark/testOrAlwaysTrue.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMPNULLABLES","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,true,true,true,true,true,true,true,true],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testOrAlwaysTrue2.json b/tests/benchmark/testOrAlwaysTrue2.json new file mode 100644 index 0000000..702d373 --- /dev/null +++ b/tests/benchmark/testOrAlwaysTrue2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMPNULLABLES","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,true,true,true,true,true,true,true,true],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testOversimplifiedCaseStatement.json b/tests/benchmark/testOversimplifiedCaseStatement.json new file mode 100644 index 0000000..b3b7a24 --- /dev/null +++ b/tests/benchmark/testOversimplifiedCaseStatement.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"operator":"CASE","operand":[{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"/","operand":[{"column":7,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"CASE","operand":[{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"operator":"/","operand":[{"column":7,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(>($3, 0), >(CASE(>($3, 0), /($7, $3), null:INTEGER), 1))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(>($3, 0), CASE(>($3, 0), >(/($7, $3), 1), false))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectAggregateMerge.json b/tests/benchmark/testProjectAggregateMerge.json new file mode 100644 index 0000000..d695cec --- /dev/null +++ b/tests/benchmark/testProjectAggregateMerge.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","SAL","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[+($1, $2)])\n LogicalAggregate(group=[{0, 1}], SS=[SUM($2)])\n LogicalProject(JOB=[$0], DEPTNO=[$2], SAL=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject($f0=[+($1, $2)])\n LogicalAggregate(group=[{0, 1}], SS=[SUM($2)])\n LogicalProject(JOB=[$0], DEPTNO=[$2], SAL=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectAggregateMergeSum0.json b/tests/benchmark/testProjectAggregateMergeSum0.json new file mode 100644 index 0000000..0856c98 --- /dev/null +++ b/tests/benchmark/testProjectAggregateMergeSum0.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":0,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalProject(SS0=[CASE(IS NOT NULL($0), CAST($0):INTEGER NOT NULL, 0)])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], agg#0=[$SUM0($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectAggregateMergeSum0AndSum.json b/tests/benchmark/testProjectAggregateMergeSum0AndSum.json new file mode 100644 index 0000000..fdb0046 --- /dev/null +++ b/tests/benchmark/testProjectAggregateMergeSum0AndSum.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"*","operand":[{"column":0,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":0,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"project":{"target":[{"operator":"*","operand":[{"column":0,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[*($0, 2)], SS0=[CASE(IS NOT NULL($0), CAST($0):INTEGER NOT NULL, 0)])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject($f0=[*($0, 2)], $f1=[$1])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)], agg#1=[$SUM0($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectCorrelateTransposeRuleLeftCorrelate.json b/tests/benchmark/testProjectCorrelateTransposeRuleLeftCorrelate.json new file mode 100644 index 0000000..fee8aa8 --- /dev/null +++ b/tests/benchmark/testProjectCorrelateTransposeRuleLeftCorrelate.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":9,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":9,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}}]}}]}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"BOOLEAN"}],"source":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}}]}}]}}}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalProject(EMPNO=[$0], $f0=[$2])\n LogicalCorrelate(correlation=[$cor2], joinType=[left], requiredColumns=[{1}])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor2.DEPTNO, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectJoinRemove1.json b/tests/benchmark/testProjectJoinRemove1.json new file mode 100644 index 0000000..b00f7cf --- /dev/null +++ b/tests/benchmark/testProjectJoinRemove1.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":1}}}}},{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}],"help":["LogicalProject(DEPTNO=[$0], DEPTNO0=[$2])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectJoinRemove10.json b/tests/benchmark/testProjectJoinRemove10.json new file mode 100644 index 0000000..33f2858 --- /dev/null +++ b/tests/benchmark/testProjectJoinRemove10.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO","SLACKER"],"types":["INTEGER","BOOLEAN"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"scan":0}],"help":["LogicalProject(DEPTNO=[$0], SLACKER=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectJoinRemove4.json b/tests/benchmark/testProjectJoinRemove4.json new file mode 100644 index 0000000..24b218f --- /dev/null +++ b/tests/benchmark/testProjectJoinRemove4.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"scan":0}],"help":["LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectJoinRemove7.json b/tests/benchmark/testProjectJoinRemove7.json new file mode 100644 index 0000000..e0461ea --- /dev/null +++ b/tests/benchmark/testProjectJoinRemove7.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"scan":1}],"help":["LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectJoinTransposeItem.json b/tests/benchmark/testProjectJoinTransposeItem.json new file mode 100644 index 0000000..bf9ea19 --- /dev/null +++ b/tests/benchmark/testProjectJoinTransposeItem.json @@ -0,0 +1 @@ +{"schemas":[{"name":"CUSTOMER","fields":["C_NATIONKEY"],"types":["ANY"],"nullable":[true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"ITEM","operand":[{"column":0,"type":"ANY"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"ANY"},{"operator":"ITEM","operand":[{"column":2,"type":"ANY"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"ANY"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"ANY"},{"column":3,"type":"ANY"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"ANY"},{"operator":"ITEM","operand":[{"column":0,"type":"ANY"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"ANY"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"ANY"},{"operator":"ITEM","operand":[{"column":0,"type":"ANY"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"ANY"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":1,"type":"ANY"},{"column":3,"type":"ANY"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"ANY"},{"column":2,"type":"ANY"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"ANY"},{"operator":"ITEM","operand":[{"column":0,"type":"ANY"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"ANY"}],"source":{"project":{"target":[{"column":0,"type":"ANY"},{"operator":"ITEM","operand":[{"column":0,"type":"ANY"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"ANY"}],"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"ANY"},{"operator":"ITEM","operand":[{"column":0,"type":"ANY"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"ANY"}],"source":{"project":{"target":[{"column":0,"type":"ANY"},{"operator":"ITEM","operand":[{"column":0,"type":"ANY"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"ANY"}],"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(EXPR$0=[ITEM($0, 0)], EXPR$1=[ITEM($2, 0)])\n LogicalJoin(condition=[=($1, $3)], joinType=[left])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$3])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalProject($f1=[$1], EXPR$0=[ITEM($0, 0)])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n LogicalProject($f1=[$1], EXPR$0=[ITEM($0, 0)])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectSetOpTranspose.json b/tests/benchmark/testProjectSetOpTranspose.json new file mode 100644 index 0000000..0a4c39e --- /dev/null +++ b/tests/benchmark/testProjectSetOpTranspose.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"error":"Not implemented: SUM"}],"source":{"union":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}]}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"error":"Not implemented: SUM"}],"source":{"union":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}]}}}],"help":["LogicalProject(JOB=[$0], EXPR$1=[SUM(+($1, 100)) OVER (PARTITION BY $2)])\n LogicalUnion(all=[true])\n LogicalProject(JOB=[$2], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$2], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(JOB=[$0], EXPR$1=[SUM($2) OVER (PARTITION BY $1)])\n LogicalUnion(all=[true])\n LogicalProject(JOB=[$2], DEPTNO=[$7], EXPR$0=[+($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$2], DEPTNO=[$7], EXPR$0=[+($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullAggregateThroughUnion.json b/tests/benchmark/testPullAggregateThroughUnion.json new file mode 100644 index 0000000..2da8670 --- /dev/null +++ b/tests/benchmark/testPullAggregateThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}]}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}},{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullAggregateThroughUnion2.json b/tests/benchmark/testPullAggregateThroughUnion2.json new file mode 100644 index 0000000..2da8670 --- /dev/null +++ b/tests/benchmark/testPullAggregateThroughUnion2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}]}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}},{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullAggregateThroughUnionAndAddProjects.json b/tests/benchmark/testPullAggregateThroughUnionAndAddProjects.json new file mode 100644 index 0000000..d466313 --- /dev/null +++ b/tests/benchmark/testPullAggregateThroughUnionAndAddProjects.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"scan":0},{"scan":0}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullAggregateThroughUnionWithAlias.json b/tests/benchmark/testPullAggregateThroughUnionWithAlias.json new file mode 100644 index 0000000..0c9fd5d --- /dev/null +++ b/tests/benchmark/testPullAggregateThroughUnionWithAlias.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"scan":0}]}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"scan":0}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantIntoFilter.json b/tests/benchmark/testPullConstantIntoFilter.json new file mode 100644 index 0000000..7697489 --- /dev/null +++ b/tests/benchmark/testPullConstantIntoFilter.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":">","operand":[{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":">","operand":[{"operator":"15","operand":[],"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>(+($7, 5), $0)])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>(15, $0)])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantIntoJoin.json b/tests/benchmark/testPullConstantIntoJoin.json new file mode 100644 index 0000000..b397556 --- /dev/null +++ b/tests/benchmark/testPullConstantIntoJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantIntoJoin2.json b/tests/benchmark/testPullConstantIntoJoin2.json new file mode 100644 index 0000000..f4796e2 --- /dev/null +++ b/tests/benchmark/testPullConstantIntoJoin2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":10,"type":"INTEGER"},{"column":11,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}},{"project":{"target":[{"operator":"10","operand":[],"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"TIMESTAMP"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"BOOLEAN"},{"operator":"10","operand":[],"type":"INTEGER"},{"column":9,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":8,"type":"INTEGER"},{"operator":"15","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$10], NAME=[$11])\n LogicalJoin(condition=[AND(=($0, $10), =($9, $12))], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[10], ENAME=[$0], JOB=[$1], MGR=[$2], HIREDATE=[$3], SAL=[$4], COMM=[$5], DEPTNO=[$6], SLACKER=[$7], DEPTNO0=[10], NAME=[$9])\n LogicalJoin(condition=[=($8, 15)], joinType=[inner])\n LogicalProject(ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, 10)])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(NAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantIntoProject.json b/tests/benchmark/testPullConstantIntoProject.json new file mode 100644 index 0000000..f9cc2f0 --- /dev/null +++ b/tests/benchmark/testPullConstantIntoProject.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(DEPTNO=[$1], EXPR$1=[+($1, 1)], EXPR$2=[+($0, $1)])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[10], EXPR$1=[11], EXPR$2=[+($0, 10)])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantIntoProjectWithIsNotDistinctFrom.json b/tests/benchmark/testPullConstantIntoProjectWithIsNotDistinctFrom.json new file mode 100644 index 0000000..f9cc2f0 --- /dev/null +++ b/tests/benchmark/testPullConstantIntoProjectWithIsNotDistinctFrom.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(DEPTNO=[$1], EXPR$1=[+($1, 1)], EXPR$2=[+($0, $1)])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[10], EXPR$1=[11], EXPR$2=[+($0, 10)])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json b/tests/benchmark/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json new file mode 100644 index 0000000..cdf5c3a --- /dev/null +++ b/tests/benchmark/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["MGR","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[true,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"IS NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"project":{"target":[{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalFilter(condition=[IS NULL($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(MGR=[null:INTEGER], DEPTNO=[$1])\n LogicalFilter(condition=[IS NULL($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughAggregateAllConst.json b/tests/benchmark/testPullConstantThroughAggregateAllConst.json new file mode 100644 index 0000000..12e815d --- /dev/null +++ b/tests/benchmark/testPullConstantThroughAggregateAllConst.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(EXPR$0=[4], EXPR$1=[+(2, 3)], FIVE=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$0], EXPR$1=[+(2, 3)], EXPR$2=[$1])\n LogicalAggregate(group=[{0}], EXPR$2=[MAX($1)])\n LogicalProject(EXPR$0=[4], FIVE=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughAggregateAllLiterals.json b/tests/benchmark/testPullConstantThroughAggregateAllLiterals.json new file mode 100644 index 0000000..b6446e2 --- /dev/null +++ b/tests/benchmark/testPullConstantThroughAggregateAllLiterals.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(EXPR$0=[4], EXPR$1=[+(2, 3)], $f2=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$0], EXPR$1=[+(2, 3)], EXPR$2=[$1])\n LogicalAggregate(group=[{0}], EXPR$2=[MAX($1)])\n LogicalProject(EXPR$0=[4], $f2=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughAggregateConstGroupBy.json b/tests/benchmark/testPullConstantThroughAggregateConstGroupBy.json new file mode 100644 index 0000000..aef8557 --- /dev/null +++ b/tests/benchmark/testPullConstantThroughAggregateConstGroupBy.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(EXPR$0=[4], EXPR$1=[+(2, 3)], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$0], EXPR$1=[+(2, 3)], EXPR$2=[$1])\n LogicalAggregate(group=[{0}], EXPR$2=[MAX($1)])\n LogicalProject(EXPR$0=[4], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughAggregatePermuted.json b/tests/benchmark/testPullConstantThroughAggregatePermuted.json new file mode 100644 index 0000000..f840faa --- /dev/null +++ b/tests/benchmark/testPullConstantThroughAggregatePermuted.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"operator":"42","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":8,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"+","operand":[{"column":11,"type":"INTEGER"},{"operator":"42","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"operator":"42","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"+","operand":[{"column":9,"type":"INTEGER"},{"operator":"42","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalProject(DEPTNO=[$0], EXPR$1=[$4])\n LogicalAggregate(group=[{0, 1, 2, 3}], EXPR$1=[MAX($4)])\n LogicalProject(DEPTNO=[$7], FOUR=[4], TWO_PLUS_THREE=[+(2, 3)], DEPTNO42=[+($7, 42)], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(DEPTNO=[$7], DEPTNO42=[+($7, 42)], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughAggregatePermutedConstFirst.json b/tests/benchmark/testPullConstantThroughAggregatePermutedConstFirst.json new file mode 100644 index 0000000..2f69fab --- /dev/null +++ b/tests/benchmark/testPullConstantThroughAggregatePermutedConstFirst.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}],"help":["LogicalProject(DEPTNO=[$1], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(FOUR=[4], DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughAggregatePermutedConstGroupBy.json b/tests/benchmark/testPullConstantThroughAggregatePermutedConstGroupBy.json new file mode 100644 index 0000000..0de7202 --- /dev/null +++ b/tests/benchmark/testPullConstantThroughAggregatePermutedConstGroupBy.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"+","operand":[{"operator":"42","operand":[],"type":"INTEGER"},{"operator":"24","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"+","operand":[{"operator":"42","operand":[],"type":"INTEGER"},{"operator":"24","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}],"help":["LogicalProject(DEPTNO=[$1], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject($f0=[+(42, 24)], DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughAggregateSimpleNonNullable.json b/tests/benchmark/testPullConstantThroughAggregateSimpleNonNullable.json new file mode 100644 index 0000000..090087b --- /dev/null +++ b/tests/benchmark/testPullConstantThroughAggregateSimpleNonNullable.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}],"help":["LogicalProject(DEPTNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(DEPTNO=[$7], FOUR=[4], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughConstLast.json b/tests/benchmark/testPullConstantThroughConstLast.json new file mode 100644 index 0000000..e1ea4b9 --- /dev/null +++ b/tests/benchmark/testPullConstantThroughConstLast.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}],"help":["LogicalProject(DEPTNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(DEPTNO=[$7], FOUR=[4], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughUnion.json b/tests/benchmark/testPullConstantThroughUnion.json new file mode 100644 index 0000000..04c3760 --- /dev/null +++ b/tests/benchmark/testPullConstantThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"union":[{"project":{"target":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}]},{"project":{"target":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}},{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}]}}}],"help":["LogicalUnion(all=[true])\n LogicalProject(EXPR$0=[2], DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[2], DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[2], DEPTNO=[$0], JOB=[$1])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughUnion3.json b/tests/benchmark/testPullConstantThroughUnion3.json new file mode 100644 index 0000000..f001f42 --- /dev/null +++ b/tests/benchmark/testPullConstantThroughUnion3.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"union":[{"project":{"target":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]},{"project":{"target":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"union":[{"project":{"target":[{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}}],"help":["LogicalUnion(all=[true])\n LogicalProject(EXPR$0=[2], EXPR$1=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[2], EXPR$1=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[2], EXPR$1=[3])\n LogicalUnion(all=[true])\n LogicalProject(EXPR$0=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullFilterThroughAggregate.json b/tests/benchmark/testPullFilterThroughAggregate.json new file mode 100644 index 0000000..b257755 --- /dev/null +++ b/tests/benchmark/testPullFilterThroughAggregate.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","SAL","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"5000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":4,"type":"INTEGER"},{"operator":"5000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"5000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}],"help":["LogicalAggregate(group=[{0, 1, 2}])\n LogicalFilter(condition=[>($1, 5000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalFilter(condition=[>($1, 5000)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullFilterThroughAggregateGroupingSets.json b/tests/benchmark/testPullFilterThroughAggregateGroupingSets.json new file mode 100644 index 0000000..e262700 --- /dev/null +++ b/tests/benchmark/testPullFilterThroughAggregateGroupingSets.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","SAL","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"5000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":4,"type":"INTEGER"},{"operator":"5000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"5000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":4,"type":"INTEGER"},{"operator":"5000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1, 2}, {0, 1}, {0}, {}]])\n LogicalFilter(condition=[>($1, 5000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1, 2}, {0, 1}, {0}, {}]])\n LogicalFilter(condition=[>($1, 5000)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullNull.json b/tests/benchmark/testPullNull.json new file mode 100644 index 0000000..4d29bd7 --- /dev/null +++ b/tests/benchmark/testPullNull.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"operator":"10","operand":[],"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 7), =($0, 10), IS NULL($3), =($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[10], ENAME=[$1], JOB=[$2], MGR=[null:INTEGER], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[7], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 7), =($0, 10), IS NULL($3))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAboveFiltersIntoInnerJoinCondition.json b/tests/benchmark/testPushAboveFiltersIntoInnerJoinCondition.json new file mode 100644 index 0000000..f1dea31 --- /dev/null +++ b/tests/benchmark/testPushAboveFiltersIntoInnerJoinCondition.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":6,"type":"TIMESTAMP"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":10,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":6,"type":"TIMESTAMP"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":10,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}],"help":["LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalFilter(condition=[>($0, $5)])\n LogicalJoin(condition=[AND(=($0, $9), >($0, $5))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalJoin(condition=[AND(=($0, $9), >($0, $5))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateFunctionsThroughJoin.json b/tests/benchmark/testPushAggregateFunctionsThroughJoin.json new file mode 100644 index 0000000..788ecf7 --- /dev/null +++ b/tests/benchmark/testPushAggregateFunctionsThroughJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","MGR","SAL","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER","INTEGER"],"nullable":[false,true,false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"operator":"+","operand":[{"column":4,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":6,"type":"BIGINT"},{"column":7,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}]}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":3,"type":"INTEGER"},{"column":8,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":3,"type":"INTEGER"},{"column":8,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"operator":"*","operand":[{"column":5,"type":"BIGINT"},{"column":8,"type":"BIGINT"}],"type":"BIGINT"},{"operator":"*","operand":[{"column":6,"type":"BIGINT"},{"column":8,"type":"BIGINT"}],"type":"BIGINT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":7,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}],"help":["LogicalProject(JOB=[$0], MIN_SAL=[$2], MIN_DEPTNO=[$3], SUM_SAL_PLUS=[+($4, 1)], MAX_SAL=[$5], SUM_SAL_2=[$4], COUNT_SAL=[$6], COUNT_MGR=[$7])\n LogicalAggregate(group=[{0, 4}], MIN_SAL=[MIN($2)], MIN_DEPTNO=[MIN($3)], SUM_SAL_2=[SUM($2)], MAX_SAL=[MAX($2)], COUNT_SAL=[COUNT()], COUNT_MGR=[COUNT($1)])\n LogicalJoin(condition=[=($0, $4)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(JOB=[$0], MIN_SAL=[$1], MIN_DEPTNO=[$2], SUM_SAL_PLUS=[+(CAST(*($3, $8)):INTEGER NOT NULL, 1)], MAX_SAL=[$4], SUM_SAL_2=[CAST(*($3, $8)):INTEGER NOT NULL], COUNT_SAL=[*($5, $8)], COUNT_MGR=[*($6, $8)])\n LogicalJoin(condition=[=($0, $7)], joinType=[inner])\n LogicalAggregate(group=[{0}], MIN_SAL=[MIN($2)], MIN_DEPTNO=[MIN($3)], SUM_SAL_2=[SUM($2)], MAX_SAL=[MAX($2)], COUNT_SAL=[COUNT()], COUNT_MGR=[COUNT($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateSumNoGroup.json b/tests/benchmark/testPushAggregateSumNoGroup.json new file mode 100644 index 0000000..f333709 --- /dev/null +++ b/tests/benchmark/testPushAggregateSumNoGroup.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"*","operand":[{"column":1,"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":0,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"*","operand":[{"column":1,"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{}], EXPR$0=[$SUM0($0)])\n LogicalProject($f4=[*($1, $3)])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateSumThroughJoin.json b/tests/benchmark/testPushAggregateSumThroughJoin.json new file mode 100644 index 0000000..a1509ca --- /dev/null +++ b/tests/benchmark/testPushAggregateSumThroughJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB","SAL"],"types":["VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}}}}]}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}],"help":["LogicalProject(JOB=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 2}], EXPR$1=[SUM($1)])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(JOB=[$1], SAL=[$2])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(JOB=[$0], EXPR$1=[CAST(*($1, $3)):INTEGER NOT NULL])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(JOB=[$1], SAL=[$2])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateSumThroughJoinAfterAggregateReduce.json b/tests/benchmark/testPushAggregateSumThroughJoinAfterAggregateReduce.json new file mode 100644 index 0000000..ef11035 --- /dev/null +++ b/tests/benchmark/testPushAggregateSumThroughJoinAfterAggregateReduce.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB","SAL"],"types":["VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}}}}]}},{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":1,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"operator":"*","operand":[{"column":2,"type":"BIGINT"},{"column":4,"type":"BIGINT"}],"type":"BIGINT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":1,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"operator":"*","operand":[{"column":2,"type":"BIGINT"},{"column":4,"type":"BIGINT"}],"type":"BIGINT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM($1)])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(JOB=[$1], SAL=[$2])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EXPR$0=[CASE(=($1, 0), null:INTEGER, $0)])\n LogicalAggregate(group=[{}], EXPR$0=[$SUM0($0)], agg#1=[$SUM0($1)])\n LogicalProject($f5=[CAST(*($1, $4)):INTEGER NOT NULL], $f6=[*($2, $4)])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$0=[$SUM0($1)], agg#1=[COUNT()])\n LogicalProject(JOB=[$1], SAL=[$2])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateSumWithoutGroupKeyThroughJoin.json b/tests/benchmark/testPushAggregateSumWithoutGroupKeyThroughJoin.json new file mode 100644 index 0000000..ea76333 --- /dev/null +++ b/tests/benchmark/testPushAggregateSumWithoutGroupKeyThroughJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB","SAL"],"types":["VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM($1)])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(JOB=[$1], SAL=[$2])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject($f4=[CAST(*($1, $3)):INTEGER])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$0=[SUM($1)])\n LogicalProject(JOB=[$1], SAL=[$2])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoin1.json b/tests/benchmark/testPushAggregateThroughJoin1.json new file mode 100644 index 0000000..8e4aa79 --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughJoin1.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB"],"types":["VARCHAR","VARCHAR"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":3,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}}}}]}},{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoin2.json b/tests/benchmark/testPushAggregateThroughJoin2.json new file mode 100644 index 0000000..e956979 --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughJoin2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","DEPTNO"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"VARCHAR"},{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":5,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"VARCHAR"},{"operator":"+","operand":[{"column":4,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0, 2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[inner])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0, 2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[inner])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoin4.json b/tests/benchmark/testPushAggregateThroughJoin4.json new file mode 100644 index 0000000..e0b1acf --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughJoin4.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"scan":1}}}}}],"help":["LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoin5.json b/tests/benchmark/testPushAggregateThroughJoin5.json new file mode 100644 index 0000000..d12cc43 --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughJoin5.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}]}},{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"scan":1}}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoin6.json b/tests/benchmark/testPushAggregateThroughJoin6.json new file mode 100644 index 0000000..c29e582 --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughJoin6.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":1,"type":"BIGINT"},{"column":2,"type":"INTEGER"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":1,"type":"BIGINT"},{"column":2,"type":"INTEGER"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM($1)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject($f3=[CAST(*($1, $2)):INTEGER])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoin7.json b/tests/benchmark/testPushAggregateThroughJoin7.json new file mode 100644 index 0000000..5feca6d --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughJoin7.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"ANY_VALUE","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"ANY_VALUE","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[ANY_VALUE($1)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[ANY_VALUE($1)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoin8.json b/tests/benchmark/testPushAggregateThroughJoin8.json new file mode 100644 index 0000000..9500fa5 --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughJoin8.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"SINGLE_VALUE","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"SINGLE_VALUE","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SINGLE_VALUE($1)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[SINGLE_VALUE($1)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoinDistinct.json b/tests/benchmark/testPushAggregateThroughJoinDistinct.json new file mode 100644 index 0000000..cfc223a --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughJoinDistinct.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","SAL"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}]}},{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}],"help":["LogicalAggregate(group=[{2}], SUM_SAL=[SUM($1)], C=[COUNT()])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$3], SUM_SAL=[$1], C=[$2])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalAggregate(group=[{0}], SUM_SAL=[SUM($1)], C=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoinOnEmptyLogicalValues.json b/tests/benchmark/testPushAggregateThroughJoinOnEmptyLogicalValues.json new file mode 100644 index 0000000..c0d1d30 --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughJoinOnEmptyLogicalValues.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}}},"right":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}}},"right":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":3,"type":"BIGINT"},{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":0,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"BIGINT"},{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], VOLUME=[COUNT()], C1_SUM_SAL=[SUM($0)])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalProject(SAL=[$5], ENAME=[$1])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], VOLUME=[$SUM0($0)], C1_SUM_SAL=[SUM($1)])\n LogicalProject(VOLUME=[$3], $f4=[CAST(*($1, $3)):INTEGER])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$0])\n LogicalProject(SAL=[$5], ENAME=[$1])\n LogicalValues(tuples=[[]])\n LogicalAggregate(group=[{0}], VOLUME=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoinWithUniqueInput.json b/tests/benchmark/testPushAggregateThroughJoinWithUniqueInput.json new file mode 100644 index 0000000..313f924 --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughJoinWithUniqueInput.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","MGR","HIREDATE","SAL","COMM","DEPTNO"],"types":["VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER"],"nullable":[false,true,false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":3,"type":"TIMESTAMP"},{"column":4,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"TIMESTAMP"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":3,"type":"TIMESTAMP"}],"distinct":false,"ignoreNulls":false,"type":"TIMESTAMP"},{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":8,"type":"TIMESTAMP"}],"distinct":false,"ignoreNulls":false,"type":"TIMESTAMP"},{"operator":"SUM","operand":[{"column":9,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":5,"type":"TIMESTAMP"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":6,"type":"TIMESTAMP"}],"distinct":false,"ignoreNulls":false,"type":"TIMESTAMP"},{"operator":"SUM","operand":[{"column":8,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":7,"type":"TIMESTAMP"},{"column":8,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":3,"type":"TIMESTAMP"},{"column":4,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":6,"type":"TIMESTAMP"},{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":3,"type":"BIGINT"},{"column":7,"type":"INTEGER"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"TIMESTAMP"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":3,"type":"TIMESTAMP"}],"distinct":false,"ignoreNulls":false,"type":"TIMESTAMP"},{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":6,"type":"TIMESTAMP"}],"distinct":false,"ignoreNulls":false,"type":"TIMESTAMP"},{"operator":"SUM","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":9,"type":"TIMESTAMP"},{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":6,"type":"BIGINT"},{"column":10,"type":"INTEGER"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"VARCHAR"},{"column":9,"type":"INTEGER"},{"column":11,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":5,"type":"TIMESTAMP"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":6,"type":"TIMESTAMP"}],"distinct":false,"ignoreNulls":false,"type":"TIMESTAMP"},{"operator":"SUM","operand":[{"column":8,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":7,"type":"TIMESTAMP"},{"column":8,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}}}]}}}}],"help":["LogicalProject(JOB=[$0], MGR0=[$2], DEPTNO=[$1], HIREDATE1=[$3], COMM1=[$4])\n LogicalAggregate(group=[{0, 2, 3}], HIREDATE1=[MAX($5)], COMM1=[SUM($6)])\n LogicalJoin(condition=[=($1, $4)], joinType=[inner])\n LogicalProject(JOB=[$0], SAL=[$3], DEPTNO=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 2}], HIREDATE1=[MAX($1)], COMM1=[SUM($3)])\n LogicalProject(MGR=[$1], HIREDATE=[$2], SAL=[$3], COMM=[$4])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(JOB=[$0], MGR0=[$2], DEPTNO=[$1], HIREDATE1=[$3], COMM1=[$4])\n LogicalAggregate(group=[{0, 1, 2}], HIREDATE1=[MAX($3)], COMM1=[SUM($4)])\n LogicalProject(JOB=[$0], DEPTNO=[$2], MGR=[$4], HIREDATE1=[$6], $f8=[CAST(*($3, $7)):INTEGER NOT NULL])\n LogicalJoin(condition=[=($1, $5)], joinType=[inner])\n LogicalAggregate(group=[{0, 1, 2}], agg#0=[COUNT()])\n LogicalProject(JOB=[$0], SAL=[$3], DEPTNO=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 2}], HIREDATE1=[MAX($1)], COMM1=[SUM($3)])\n LogicalProject(MGR=[$1], HIREDATE=[$2], SAL=[$3], COMM=[$4])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin1.json b/tests/benchmark/testPushAggregateThroughOuterJoin1.json new file mode 100644 index 0000000..fac98db --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughOuterJoin1.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB"],"types":["VARCHAR","VARCHAR"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":1}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalAggregate(group=[{0, 1}])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin12.json b/tests/benchmark/testPushAggregateThroughOuterJoin12.json new file mode 100644 index 0000000..020fc1d --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughOuterJoin12.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB"],"types":["VARCHAR","VARCHAR"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin13.json b/tests/benchmark/testPushAggregateThroughOuterJoin13.json new file mode 100644 index 0000000..c80a300 --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughOuterJoin13.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB"],"types":["VARCHAR","VARCHAR"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[full])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[full])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin14.json b/tests/benchmark/testPushAggregateThroughOuterJoin14.json new file mode 100644 index 0000000..ea222e6 --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughOuterJoin14.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["MGR"],"types":["INTEGER"],"nullable":[true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[full])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin15.json b/tests/benchmark/testPushAggregateThroughOuterJoin15.json new file mode 100644 index 0000000..28e78fd --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughOuterJoin15.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB","MGR"],"types":["VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":4,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0, 3}])\n LogicalJoin(condition=[=($1, $2)], joinType=[full])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalProject(ENAME=[$0], JOB=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$1], MGR=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 3}])\n LogicalJoin(condition=[=($1, $2)], joinType=[full])\n LogicalAggregate(group=[{0, 1}])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalProject(ENAME=[$0], JOB=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$1], MGR=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin16.json b/tests/benchmark/testPushAggregateThroughOuterJoin16.json new file mode 100644 index 0000000..868e3f3 --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughOuterJoin16.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","DEPTNO"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"FULL","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":4,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"FULL","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":4,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"VARCHAR"},{"operator":"+","operand":[{"column":6,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":4,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[full])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[full])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin2.json b/tests/benchmark/testPushAggregateThroughOuterJoin2.json new file mode 100644 index 0000000..0bda5c9 --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughOuterJoin2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB"],"types":["VARCHAR","VARCHAR"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{1}])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{1}])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin3.json b/tests/benchmark/testPushAggregateThroughOuterJoin3.json new file mode 100644 index 0000000..698653d --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughOuterJoin3.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB","MGR"],"types":["VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":4,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0, 3}])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalProject(ENAME=[$0], JOB=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$1], MGR=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 3}])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalAggregate(group=[{0, 1}])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalProject(ENAME=[$0], JOB=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$1], MGR=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin4.json b/tests/benchmark/testPushAggregateThroughOuterJoin4.json new file mode 100644 index 0000000..4564fd4 --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughOuterJoin4.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB"],"types":["VARCHAR","VARCHAR"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}}}}]}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}],"help":["LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(JOB=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin5.json b/tests/benchmark/testPushAggregateThroughOuterJoin5.json new file mode 100644 index 0000000..50f6d63 --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughOuterJoin5.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB"],"types":["VARCHAR","VARCHAR"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin6.json b/tests/benchmark/testPushAggregateThroughOuterJoin6.json new file mode 100644 index 0000000..b9a6012 --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughOuterJoin6.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","JOB"],"types":["VARCHAR","VARCHAR"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":3,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}}}}]}},{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin7.json b/tests/benchmark/testPushAggregateThroughOuterJoin7.json new file mode 100644 index 0000000..d0c1721 --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughOuterJoin7.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","DEPTNO"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":4,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":4,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"VARCHAR"},{"operator":"+","operand":[{"column":6,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":4,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin8.json b/tests/benchmark/testPushAggregateThroughOuterJoin8.json new file mode 100644 index 0000000..051fd6f --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughOuterJoin8.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","DEPTNO"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":4,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":4,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"VARCHAR"},{"operator":"+","operand":[{"column":6,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":4,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin9.json b/tests/benchmark/testPushAggregateThroughOuterJoin9.json new file mode 100644 index 0000000..833864c --- /dev/null +++ b/tests/benchmark/testPushAggregateThroughOuterJoin9.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","DEPTNO"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"VARCHAR"},{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":5,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"VARCHAR"},{"operator":"+","operand":[{"column":4,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0, 2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0, 2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAvgGroupingSetsThroughUnion.json b/tests/benchmark/testPushAvgGroupingSetsThroughUnion.json new file mode 100644 index 0000000..acc7a59 --- /dev/null +++ b/tests/benchmark/testPushAvgGroupingSetsThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","JOB","DEPTNO"],"types":["INTEGER","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}]}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[AVG($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[AVG($2)])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAvgThroughUnion.json b/tests/benchmark/testPushAvgThroughUnion.json new file mode 100644 index 0000000..ef8991c --- /dev/null +++ b/tests/benchmark/testPushAvgThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}]}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[AVG($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[AVG($1)])\n LogicalUnion(all=[true])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushBoolAndBoolOrThroughUnion.json b/tests/benchmark/testPushBoolAndBoolOrThroughUnion.json new file mode 100644 index 0000000..1bd2781 --- /dev/null +++ b/tests/benchmark/testPushBoolAndBoolOrThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":0,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":0,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}]}}},{"aggregate":{"function":[{"operator":"BOOL_AND","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"},{"operator":"BOOL_OR","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":1,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}},{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":1,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":0,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"BOOL_AND","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"},{"operator":"BOOL_OR","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":1,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":0,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"BOOL_AND","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"},{"operator":"BOOL_OR","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":1,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"BOOL_AND","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"},{"operator":"BOOL_OR","operand":[{"column":3,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":1,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"BOOL_AND","operand":[{"column":3,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"},{"operator":"BOOL_OR","operand":[{"column":3,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":2,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":1,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"BOOL_AND","operand":[{"column":3,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"},{"operator":"BOOL_OR","operand":[{"column":3,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":2,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($1)])\n LogicalUnion(all=[true])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($1)])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($1)])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushCountFilterThroughUnion.json b/tests/benchmark/testPushCountFilterThroughUnion.json new file mode 100644 index 0000000..180bdce --- /dev/null +++ b/tests/benchmark/testPushCountFilterThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"union":[{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}]}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"union":[{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT() FILTER $1])\n LogicalProject(DEPTNO=[$1], $f1=[=($0, 'CLERK')])\n LogicalUnion(all=[true])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($1, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT() FILTER $1])\n LogicalProject(DEPTNO=[$1], $f1=[=($0, 'CLERK')])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT() FILTER $1])\n LogicalProject(DEPTNO=[$1], $f1=[=($0, 'CLERK')])\n LogicalFilter(condition=[>($1, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushCountNullableGroupingSetsThroughUnion.json b/tests/benchmark/testPushCountNullableGroupingSetsThroughUnion.json new file mode 100644 index 0000000..8a42894 --- /dev/null +++ b/tests/benchmark/testPushCountNullableGroupingSetsThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","MGR","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,true,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":4,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[$SUM0($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushCountNullableThroughUnion.json b/tests/benchmark/testPushCountNullableThroughUnion.json new file mode 100644 index 0000000..65ab9a5 --- /dev/null +++ b/tests/benchmark/testPushCountNullableThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","MGR"],"types":["VARCHAR","INTEGER"],"nullable":[false,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"scan":0},{"scan":0}]}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"scan":0},{"scan":0}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushCountStarGroupingSetsThroughUnion.json b/tests/benchmark/testPushCountStarGroupingSetsThroughUnion.json new file mode 100644 index 0000000..5c0e462 --- /dev/null +++ b/tests/benchmark/testPushCountStarGroupingSetsThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":4,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT()])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[$SUM0($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushCountStarThroughUnion.json b/tests/benchmark/testPushCountStarThroughUnion.json new file mode 100644 index 0000000..8f4b81e --- /dev/null +++ b/tests/benchmark/testPushCountStarThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"scan":0},{"scan":0}]}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"scan":0},{"scan":0}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushFilterPastAgg.json b/tests/benchmark/testPushFilterPastAgg.json new file mode 100644 index 0000000..1a1f21d --- /dev/null +++ b/tests/benchmark/testPushFilterPastAgg.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}],"help":["LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalAggregate(group=[{0}], C=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}], C=[COUNT()])\n LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushFilterPastAggFour.json b/tests/benchmark/testPushFilterPastAggFour.json new file mode 100644 index 0000000..26fd3bb --- /dev/null +++ b/tests/benchmark/testPushFilterPastAggFour.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"12","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":3,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"12","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"12","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"12","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":3,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"12","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"12","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{1}], EXPR$1=[$SUM0($2)])\n LogicalFilter(condition=[>($0, 12)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{1}], EXPR$1=[$SUM0($2)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT()])\n LogicalFilter(condition=[>($0, 12)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushFilterPastAggTwo.json b/tests/benchmark/testPushFilterPastAggTwo.json new file mode 100644 index 0000000..8bc25ab --- /dev/null +++ b/tests/benchmark/testPushFilterPastAggTwo.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":">","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'c'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"operator":"OR","operand":[{"operator":">","operand":[{"column":1,"type":"BIGINT"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'z'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'b'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'b'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":">","operand":[{"column":1,"type":"BIGINT"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'z'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'c'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'b'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'c'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'b'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}}],"help":["LogicalProject(C1=[$0])\n LogicalFilter(condition=[AND(>($0, 'c'), OR(>($1, 30), <($0, 'z')))])\n LogicalAggregate(group=[{0}], C2=[COUNT()])\n LogicalFilter(condition=[>($0, 'b')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(C1=[$0])\n LogicalFilter(condition=[OR(>($1, 30), <($0, 'z'))])\n LogicalAggregate(group=[{0}], C2=[COUNT()])\n LogicalFilter(condition=[>($0, 'c')])\n LogicalFilter(condition=[>($0, 'b')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushFilterPastAggWithGroupingSets2.json b/tests/benchmark/testPushFilterPastAggWithGroupingSets2.json new file mode 100644 index 0000000..502306f --- /dev/null +++ b/tests/benchmark/testPushFilterPastAggWithGroupingSets2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}]}}}}],"help":["LogicalProject(DNAME=[$0], DDEPTNO=[$1], C=[$2])\n LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]], C=[COUNT()])\n LogicalProject(DNAME=[$1], DDEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(DNAME=[$0], DDEPTNO=[$1], C=[$2])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]], C=[COUNT()])\n LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalProject(DNAME=[$1], DDEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushFilterPastProject.json b/tests/benchmark/testPushFilterPastProject.json new file mode 100644 index 0000000..94df990 --- /dev/null +++ b/tests/benchmark/testPushFilterPastProject.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"column":1,"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"column":2,"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}],"help":["LogicalProject(NAME=[$0])\n LogicalJoin(condition=[$1], joinType=[right])\n LogicalProject(NAME=[$0], $f4=[>($1, 10)])\n LogicalJoin(condition=[$2], joinType=[left])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], $f2=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0])\n LogicalJoin(condition=[true], joinType=[right])\n LogicalProject(NAME=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($0, 10)])\n LogicalFilter(condition=[>($0, 10)])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushFilterSemijoin.json b/tests/benchmark/testPushFilterSemijoin.json new file mode 100644 index 0000000..80f9cea --- /dev/null +++ b/tests/benchmark/testPushFilterSemijoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","DNAME"],"types":["TINYINT","VARCHAR"],"nullable":[false,true],"key":[[0],[1]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","SAL","DEPTNO"],"types":["SMALLINT","DECIMAL","TINYINT"],"nullable":[false,true,true],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":4,"type":"TINYINT"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"DECIMAL"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":4,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"DECIMAL"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}],"help":["LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[AND(=($0, $4), =($3, 100))], joinType=[semi])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, EMP]])\n","LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $4)], joinType=[semi])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalFilter(condition=[=($1, 100)])\n LogicalTableScan(table=[[scott, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushFilterThroughSemiJoin.json b/tests/benchmark/testPushFilterThroughSemiJoin.json new file mode 100644 index 0000000..2fbd43c --- /dev/null +++ b/tests/benchmark/testPushFilterThroughSemiJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"<=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"<=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":1}}}],"help":["LogicalFilter(condition=[<=($0, 10)])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalFilter(condition=[<=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushFilterWithIsNotDistinctFromPastJoin.json b/tests/benchmark/testPushFilterWithIsNotDistinctFromPastJoin.json new file mode 100644 index 0000000..8a3fc63 --- /dev/null +++ b/tests/benchmark/testPushFilterWithIsNotDistinctFromPastJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":10,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":10,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT DISTINCT FROM","operand":[{"column":1,"type":"VARCHAR"},{"column":10,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalFilter(condition=[OR(AND(IS NULL($1), IS NULL($10)), IS TRUE(=($1, $10)))])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[AND(=($7, $16), IS NOT DISTINCT FROM($1, $10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushJoinCondDownToProject.json b/tests/benchmark/testPushJoinCondDownToProject.json new file mode 100644 index 0000000..ea7a3df --- /dev/null +++ b/tests/benchmark/testPushJoinCondDownToProject.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"=","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":7,"type":"INTEGER"}],"source":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"*","operand":[{"column":7,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}],"help":["LogicalFilter(condition=[=(+($0, 10), *($1, 2))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], DEPTNO0=[$2])\n LogicalJoin(condition=[=($1, $3)], joinType=[inner])\n LogicalProject(DEPTNO=[$0], $f2=[+($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7], $f9=[*($7, 2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushJoinThroughUnionOnLeft.json b/tests/benchmark/testPushJoinThroughUnionOnLeft.json new file mode 100644 index 0000000..d29b339 --- /dev/null +++ b/tests/benchmark/testPushJoinThroughUnionOnLeft.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"union":[{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}]},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}],"help":["LogicalProject(SAL=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalUnion(all=[true])\n LogicalProject(SAL=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(SAL=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushJoinThroughUnionOnRight.json b/tests/benchmark/testPushJoinThroughUnionOnRight.json new file mode 100644 index 0000000..e6015bf --- /dev/null +++ b/tests/benchmark/testPushJoinThroughUnionOnRight.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"union":[{"project":{"target":[{"column":8,"type":"BOOLEAN"}],"source":{"scan":0}}},{"project":{"target":[{"column":8,"type":"BOOLEAN"}],"source":{"scan":0}}}]}}}}},{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}],"help":["LogicalProject(SAL=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalUnion(all=[true])\n LogicalProject(SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalUnion(all=[true])\n LogicalProject(SAL=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(SAL=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushMaxNullableGroupingSetsThroughUnion.json b/tests/benchmark/testPushMaxNullableGroupingSetsThroughUnion.json new file mode 100644 index 0000000..954b44a --- /dev/null +++ b/tests/benchmark/testPushMaxNullableGroupingSetsThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","MGR","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,true,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MAX($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MAX($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushMaxNullableThroughUnion.json b/tests/benchmark/testPushMaxNullableThroughUnion.json new file mode 100644 index 0000000..003381a --- /dev/null +++ b/tests/benchmark/testPushMaxNullableThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","MGR"],"types":["VARCHAR","INTEGER"],"nullable":[false,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"scan":0},{"scan":0}]}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"scan":0},{"scan":0}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushMinGroupingSetsThroughUnion.json b/tests/benchmark/testPushMinGroupingSetsThroughUnion.json new file mode 100644 index 0000000..d4548e9 --- /dev/null +++ b/tests/benchmark/testPushMinGroupingSetsThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","JOB","DEPTNO"],"types":["INTEGER","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MIN($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MIN($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MIN($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MIN($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushMinThroughUnion.json b/tests/benchmark/testPushMinThroughUnion.json new file mode 100644 index 0000000..49fffb4 --- /dev/null +++ b/tests/benchmark/testPushMinThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastFilter.json b/tests/benchmark/testPushProjectPastFilter.json new file mode 100644 index 0000000..c2aef1e --- /dev/null +++ b/tests/benchmark/testPushProjectPastFilter.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","SAL","COMM","DEPTNO"],"types":["INTEGER","VARCHAR","INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"*","operand":[{"operator":"10","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"operator":"UPPER","operand":[{"column":1,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"_ISO-8859-1'FOO'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"*","operand":[{"operator":"10","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"operator":"UPPER","operand":[{"column":1,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"_ISO-8859-1'FOO'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EXPR$0=[+($0, $4)])\n LogicalFilter(condition=[AND(=($2, *(10, $3)), =(UPPER($1), 'FOO'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[+($0, $4)])\n LogicalFilter(condition=[AND(=($2, *(10, $3)), =(UPPER($1), 'FOO'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastFilter2.json b/tests/benchmark/testPushProjectPastFilter2.json new file mode 100644 index 0000000..e77ed86 --- /dev/null +++ b/tests/benchmark/testPushProjectPastFilter2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["MGR"],"types":["INTEGER"],"nullable":[true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalFilter(condition=[<($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalFilter(condition=[<($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastFilter3b.json b/tests/benchmark/testPushProjectPastFilter3b.json new file mode 100644 index 0000000..ba8127c --- /dev/null +++ b/tests/benchmark/testPushProjectPastFilter3b.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"operator":"*","operand":[{"operator":"10","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"operator":"UPPER","operand":[{"column":1,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"_ISO-8859-1'FOO'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"TIMESTAMP"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"column":7,"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"operator":"*","operand":[{"operator":"10","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"operator":"UPPER","operand":[{"column":1,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"_ISO-8859-1'FOO'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}],"help":["LogicalProject(X=[+($0, $7)], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(X=[$8], ENAME=[$0], JOB=[$1], MGR=[$2], HIREDATE=[$3], SAL=[$4], COMM=[$5], SLACKER=[$6])\n LogicalFilter(condition=[$7])\n LogicalProject(ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], $f7=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))], $f8=[+($0, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastFilter3c.json b/tests/benchmark/testPushProjectPastFilter3c.json new file mode 100644 index 0000000..601c3f6 --- /dev/null +++ b/tests/benchmark/testPushProjectPastFilter3c.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"operator":"*","operand":[{"operator":"10","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"operator":"UPPER","operand":[{"column":1,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"_ISO-8859-1'FOO'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"TIMESTAMP"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"operator":"*","operand":[{"operator":"10","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"operator":"UPPER","operand":[{"column":0,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"_ISO-8859-1'FOO'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}],"help":["LogicalProject(X=[+($0, $7)], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(X=[$7], ENAME=[$0], JOB=[$1], MGR=[$2], HIREDATE=[$3], SAL=[$4], COMM=[$5], SLACKER=[$6])\n LogicalFilter(condition=[AND(=($4, *(10, $5)), =(UPPER($0), 'FOO'))])\n LogicalProject(ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], $f7=[+($0, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastFullJoin.json b/tests/benchmark/testPushProjectPastFullJoin.json new file mode 100644 index 0000000..092042f --- /dev/null +++ b/tests/benchmark/testPushProjectPastFullJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"column":1,"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"column":2,"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($1, 11), 11, *(-1, $1))])\n LogicalJoin(condition=[=($0, $2)], joinType=[full])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE($1, 11, $2)])\n LogicalJoin(condition=[=($0, $3)], joinType=[full])\n LogicalProject(ENAME=[$1], EXPR$0=[<($5, 11)], EXPR$1=[*(-1, $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastFullJoinStrong.json b/tests/benchmark/testPushProjectPastFullJoinStrong.json new file mode 100644 index 0000000..0228fa8 --- /dev/null +++ b/tests/benchmark/testPushProjectPastFullJoinStrong.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($1, 11), *(-1, $1), $1)])\n LogicalJoin(condition=[=($0, $2)], joinType=[full])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[full])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastInnerJoin.json b/tests/benchmark/testPushProjectPastInnerJoin.json new file mode 100644 index 0000000..e6b9b1a --- /dev/null +++ b/tests/benchmark/testPushProjectPastInnerJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($1, 11), 11, *(-1, $1))])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastInnerJoinStrong.json b/tests/benchmark/testPushProjectPastInnerJoinStrong.json new file mode 100644 index 0000000..13ab49c --- /dev/null +++ b/tests/benchmark/testPushProjectPastInnerJoinStrong.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($1, 11), *(-1, $1), $1)])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastJoin.json b/tests/benchmark/testPushProjectPastJoin.json new file mode 100644 index 0000000..4b73d5b --- /dev/null +++ b/tests/benchmark/testPushProjectPastJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME","COMM"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}},{"project":{"target":[{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalProject(EXPR$0=[+($1, $4)])\n LogicalJoin(condition=[AND(=($0, $3), =($2, 10))], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[+($1, $4)])\n LogicalJoin(condition=[AND(=($0, $3), $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastLeftJoin.json b/tests/benchmark/testPushProjectPastLeftJoin.json new file mode 100644 index 0000000..3b9f8ea --- /dev/null +++ b/tests/benchmark/testPushProjectPastLeftJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($1, 11), 11, *(-1, $1))])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastLeftJoinSwap.json b/tests/benchmark/testPushProjectPastLeftJoinSwap.json new file mode 100644 index 0000000..49ea480 --- /dev/null +++ b/tests/benchmark/testPushProjectPastLeftJoinSwap.json @@ -0,0 +1 @@ +{"schemas":[{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":3,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"column":2,"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"column":3,"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($2, 11), 11, *(-1, $2))])\n LogicalJoin(condition=[=($1, $0)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE($2, 11, $3)])\n LogicalJoin(condition=[=($1, $0)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$0=[<($5, 11)], EXPR$1=[*(-1, $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastLeftJoinSwapStrong.json b/tests/benchmark/testPushProjectPastLeftJoinSwapStrong.json new file mode 100644 index 0000000..f3c83a3 --- /dev/null +++ b/tests/benchmark/testPushProjectPastLeftJoinSwapStrong.json @@ -0,0 +1 @@ +{"schemas":[{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":3,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($2, 11), *(-1, $2), $2)])\n LogicalJoin(condition=[=($1, $0)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$2])\n LogicalJoin(condition=[=($1, $0)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastRightJoin.json b/tests/benchmark/testPushProjectPastRightJoin.json new file mode 100644 index 0000000..3cd0a1c --- /dev/null +++ b/tests/benchmark/testPushProjectPastRightJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"column":1,"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"column":2,"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($1, 11), 11, *(-1, $1))])\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE($1, 11, $2)])\n LogicalJoin(condition=[=($0, $3)], joinType=[right])\n LogicalProject(ENAME=[$1], EXPR$0=[<($5, 11)], EXPR$1=[*(-1, $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastRightJoinStrong.json b/tests/benchmark/testPushProjectPastRightJoinStrong.json new file mode 100644 index 0000000..29581a8 --- /dev/null +++ b/tests/benchmark/testPushProjectPastRightJoinStrong.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($1, 11), *(-1, $1), $1)])\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastRightJoinSwap.json b/tests/benchmark/testPushProjectPastRightJoinSwap.json new file mode 100644 index 0000000..6ec9d9a --- /dev/null +++ b/tests/benchmark/testPushProjectPastRightJoinSwap.json @@ -0,0 +1 @@ +{"schemas":[{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":3,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($2, 11), 11, *(-1, $2))])\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$2])\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastRightJoinSwapStrong.json b/tests/benchmark/testPushProjectPastRightJoinSwapStrong.json new file mode 100644 index 0000000..11accdd --- /dev/null +++ b/tests/benchmark/testPushProjectPastRightJoinSwapStrong.json @@ -0,0 +1 @@ +{"schemas":[{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":3,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($2, 11), *(-1, $2), $2)])\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$2])\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastSetOp.json b/tests/benchmark/testPushProjectPastSetOp.json new file mode 100644 index 0000000..b079b25 --- /dev/null +++ b/tests/benchmark/testPushProjectPastSetOp.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"union":[{"scan":0},{"scan":0}]},{"union":[{"scan":0},{"scan":0}]}],"help":["LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectWithIsNotDistinctFromPastJoin.json b/tests/benchmark/testPushProjectWithIsNotDistinctFromPastJoin.json new file mode 100644 index 0000000..16e22b8 --- /dev/null +++ b/tests/benchmark/testPushProjectWithIsNotDistinctFromPastJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME","JOB","SAL","COMM"],"types":["VARCHAR","VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"IS NOT DISTINCT FROM","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"operator":"||","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"||","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"VARCHAR"}],"source":{"scan":1}}}}}}},{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"IS NOT DISTINCT FROM","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"},{"operator":"||","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"||","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"VARCHAR"}],"source":{"scan":1}}}}}}}],"help":["LogicalProject(EXPR$0=[+($0, $3)])\n LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($2, $4), =($1, 10))], joinType=[inner])\n LogicalProject(SAL=[$5], DEPTNO=[$7], $f9=[||($1, $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(COMM=[$3], $f4=[||($0, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[+($0, $3)])\n LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($1, $4), $2)], joinType=[inner])\n LogicalProject(SAL=[$5], $f9=[||($1, $2)], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(COMM=[$3], $f4=[||($0, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectWithOverPastJoin1.json b/tests/benchmark/testPushProjectWithOverPastJoin1.json new file mode 100644 index 0000000..84b05ba --- /dev/null +++ b/tests/benchmark/testPushProjectWithOverPastJoin1.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME","COMM"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"},{"error":"Not implemented: COUNT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}},{"project":{"target":[{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"},{"error":"Not implemented: COUNT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"},{"column":4,"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalProject(EXPR$0=[+($2, $5)], EXPR$1=[COUNT($0) OVER (PARTITION BY $3)])\n LogicalJoin(condition=[AND(=($1, $4), =($3, 10))], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[+($2, $6)], EXPR$1=[COUNT($0) OVER (PARTITION BY $3)])\n LogicalJoin(condition=[AND(=($1, $5), $4)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], SAL=[$5], DEPTNO=[$7], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectWithOverPastJoin2.json b/tests/benchmark/testPushProjectWithOverPastJoin2.json new file mode 100644 index 0000000..8a3cb82 --- /dev/null +++ b/tests/benchmark/testPushProjectWithOverPastJoin2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME","JOB","SAL","COMM"],"types":["VARCHAR","VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"},{"error":"Not implemented: COUNT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}},{"project":{"target":[{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"},{"error":"Not implemented: COUNT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalProject(EXPR$0=[+($1, $6)], EXPR$1=[COUNT($5) OVER (PARTITION BY $4)])\n LogicalJoin(condition=[AND(=($0, $3), =($2, 10))], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[+($1, $6)], EXPR$1=[COUNT($5) OVER (PARTITION BY $4)])\n LogicalJoin(condition=[AND(=($0, $3), $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectWithOverPastJoin3.json b/tests/benchmark/testPushProjectWithOverPastJoin3.json new file mode 100644 index 0000000..b3b702a --- /dev/null +++ b/tests/benchmark/testPushProjectWithOverPastJoin3.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME","JOB","SAL","COMM"],"types":["VARCHAR","VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"},{"error":"Not implemented: SUM"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}},{"project":{"target":[{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"},{"error":"Not implemented: SUM"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}],"help":["LogicalProject(EXPR$0=[+($1, $6)], EXPR$1=[SUM(+(+($5, $5), 100)) OVER (PARTITION BY $4)])\n LogicalJoin(condition=[AND(=($0, $3), =($2, 10))], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[+($1, $5)], EXPR$1=[SUM($6) OVER (PARTITION BY $4)])\n LogicalJoin(condition=[AND(=($0, $3), $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0], JOB=[$1], COMM=[$3], EXPR$0=[+(+($2, $2), 100)])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSemiJoinConditions.json b/tests/benchmark/testPushSemiJoinConditions.json new file mode 100644 index 0000000..913c47e --- /dev/null +++ b/tests/benchmark/testPushSemiJoinConditions.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","DEPTNO"],"types":["SMALLINT","VARCHAR","TINYINT"],"nullable":[false,true,true],"key":[[0],[1]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","DNAME"],"types":["TINYINT","VARCHAR"],"nullable":[false,true],"key":[[0],[1]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"TINYINT"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"AND","operand":[{"operator":"OR","operand":[{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":2,"type":"TINYINT"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":0,"type":"TINYINT"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":2,"type":"TINYINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"OR","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"TINYINT"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"scan":1}}}}},{"project":{"target":[{"column":2,"type":"TINYINT"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"AND","operand":[{"operator":"IS NOT DISTINCT FROM","operand":[{"column":2,"type":"TINYINT"},{"column":3,"type":"TINYINT"}],"type":"BOOLEAN"},{"operator":"IS NOT DISTINCT FROM","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}],"help":["LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[AND(OR(=($0, $2), AND(IS NULL($0), IS NULL($2))), OR(=($1, $3), AND(IS NULL($1), IS NULL($3))))], joinType=[semi])\n LogicalProject(DEPTNO=[$2], ENAME=[$1])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, DEPT]])\n","LogicalProject(DEPTNO=[$2])\n LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($2, $3), IS NOT DISTINCT FROM($1, $4))], joinType=[semi])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSemiJoinPastFilter.json b/tests/benchmark/testPushSemiJoinPastFilter.json new file mode 100644 index 0000000..3793943 --- /dev/null +++ b/tests/benchmark/testPushSemiJoinPastFilter.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'foo'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'foo'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},"right":{"scan":1}}}}}],"help":["LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[AND(=($1, $2), =($0, 'foo'))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(ENAME=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalFilter(condition=[=($0, 'foo')])\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSemiJoinPastJoinRuleLeft.json b/tests/benchmark/testPushSemiJoinPastJoinRuleLeft.json new file mode 100644 index 0000000..5ff7da7 --- /dev/null +++ b/tests/benchmark/testPushSemiJoinPastJoinRuleLeft.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","DEPTNO"],"types":["INTEGER","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},"right":{"scan":1}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}],"help":["LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($2, $3), =($0, $4))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($0, $4)], joinType=[inner])\n LogicalJoin(condition=[=($2, $3)], joinType=[inner])\n LogicalJoin(condition=[=($0, $3)], joinType=[semi])\n LogicalJoin(condition=[=($2, $3)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSemiJoinPastJoinRuleRight.json b/tests/benchmark/testPushSemiJoinPastJoinRuleRight.json new file mode 100644 index 0000000..10ccddb --- /dev/null +++ b/tests/benchmark/testPushSemiJoinPastJoinRuleRight.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":1},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}],"help":["LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[AND(=($1, $2), =($2, $3))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(ENAME=[$0])\n LogicalJoin(condition=[=($2, $3)], joinType=[inner])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalJoin(condition=[=($0, $1)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSemiJoinPastProject.json b/tests/benchmark/testPushSemiJoinPastProject.json new file mode 100644 index 0000000..f4cc8ed --- /dev/null +++ b/tests/benchmark/testPushSemiJoinPastProject.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"TRIM","operand":[{"operator":"BOTH","operand":[],"type":"SYMBOL"},{"operator":"_ISO-8859-1' '","operand":[],"type":"CHAR"},{"column":2,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"*","operand":[{"column":5,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":"TRIM","operand":[{"operator":"BOTH","operand":[],"type":"SYMBOL"},{"operator":"_ISO-8859-1' '","operand":[],"type":"CHAR"},{"column":1,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}},"right":{"scan":1}}}}}],"help":["LogicalProject(ENAME=[$0], EXPR$1=[$1], EXPR$2=[$2], DEPTNO=[$3])\n LogicalFilter(condition=[=($3, $4)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(ENAME=[$1], EXPR$1=[TRIM(FLAG(BOTH), ' ', $2)], EXPR$2=[*($5, 2)], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(ENAME=[$0], EXPR$1=[$1], EXPR$2=[$2], DEPTNO=[$3])\n LogicalJoin(condition=[=($3, $4)], joinType=[inner])\n LogicalProject(ENAME=[$0], EXPR$1=[TRIM(FLAG(BOTH), ' ', $1)], EXPR$2=[*($2, 2)], DEPTNO=[$3])\n LogicalJoin(condition=[=($3, $4)], joinType=[semi])\n LogicalProject(ENAME=[$1], JOB=[$2], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSumConstantGroupingSetsThroughUnion.json b/tests/benchmark/testPushSumConstantGroupingSetsThroughUnion.json new file mode 100644 index 0000000..2d1f2cd --- /dev/null +++ b/tests/benchmark/testPushSumConstantGroupingSetsThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"union":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"union":[{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":9,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":9,"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":6,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":6,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$1], JOB=[$0], U=[$2])\n LogicalUnion(all=[true])\n LogicalProject(JOB=[$2], DEPTNO=[$7], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$2], DEPTNO=[$7], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSumConstantThroughUnion.json b/tests/benchmark/testPushSumConstantThroughUnion.json new file mode 100644 index 0000000..b50c00e --- /dev/null +++ b/tests/benchmark/testPushSumConstantThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalProject(ENAME=[$1], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$1], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSumCountStarGroupingSetsThroughUnion.json b/tests/benchmark/testPushSumCountStarGroupingSetsThroughUnion.json new file mode 100644 index 0000000..8570ebc --- /dev/null +++ b/tests/benchmark/testPushSumCountStarGroupingSetsThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","JOB","DEPTNO"],"types":["INTEGER","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":5,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)], EXPR$3=[COUNT()], EXPR$4=[MIN($0)], EXPR$5=[MAX($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)], EXPR$3=[$SUM0($3)], EXPR$4=[MIN($4)], EXPR$5=[MAX($5)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)], EXPR$3=[COUNT()], EXPR$4=[MIN($0)], EXPR$5=[MAX($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)], EXPR$3=[COUNT()], EXPR$4=[MIN($0)], EXPR$5=[MAX($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSumCountStarThroughUnion.json b/tests/benchmark/testPushSumCountStarThroughUnion.json new file mode 100644 index 0000000..614f6e6 --- /dev/null +++ b/tests/benchmark/testPushSumCountStarThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","DEPTNO"],"types":["INTEGER","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":3,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT()], EXPR$3=[MIN($2)], EXPR$4=[MAX($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], DEPTNO=[$2])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[$SUM0($2)], EXPR$3=[MIN($3)], EXPR$4=[MAX($4)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT()], EXPR$3=[MIN($2)], EXPR$4=[MAX($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], DEPTNO=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT()], EXPR$3=[MIN($2)], EXPR$4=[MAX($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], DEPTNO=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSumNullConstantGroupingSetsThroughUnion.json b/tests/benchmark/testPushSumNullConstantGroupingSetsThroughUnion.json new file mode 100644 index 0000000..43856d6 --- /dev/null +++ b/tests/benchmark/testPushSumNullConstantGroupingSetsThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"union":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"union":[{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":9,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":9,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":6,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":6,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$1], JOB=[$0], U=[$2])\n LogicalUnion(all=[true])\n LogicalProject(JOB=[$2], DEPTNO=[$7], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$2], DEPTNO=[$7], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSumNullConstantThroughUnion.json b/tests/benchmark/testPushSumNullConstantThroughUnion.json new file mode 100644 index 0000000..43ab2f7 --- /dev/null +++ b/tests/benchmark/testPushSumNullConstantThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalProject(ENAME=[$1], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$1], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSumNullableGroupingSetsThroughUnion.json b/tests/benchmark/testPushSumNullableGroupingSetsThroughUnion.json new file mode 100644 index 0000000..bca61ca --- /dev/null +++ b/tests/benchmark/testPushSumNullableGroupingSetsThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","MGR","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,true,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSumNullableNOGBYThroughUnion.json b/tests/benchmark/testPushSumNullableNOGBYThroughUnion.json new file mode 100644 index 0000000..142c961 --- /dev/null +++ b/tests/benchmark/testPushSumNullableNOGBYThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["MGR"],"types":["INTEGER"],"nullable":[true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"union":[{"scan":0},{"scan":0}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"union":[{"scan":0},{"scan":0}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSumNullableThroughUnion.json b/tests/benchmark/testPushSumNullableThroughUnion.json new file mode 100644 index 0000000..7415aff --- /dev/null +++ b/tests/benchmark/testPushSumNullableThroughUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","MGR"],"types":["VARCHAR","INTEGER"],"nullable":[false,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"scan":0},{"scan":0}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"scan":0},{"scan":0}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceAggregateFunctionsByGroup.json b/tests/benchmark/testReduceAggregateFunctionsByGroup.json new file mode 100644 index 0000000..8018a09 --- /dev/null +++ b/tests/benchmark/testReduceAggregateFunctionsByGroup.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"ANY_VALUE","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"FIRST_VALUE","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"LAST_VALUE","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}],"help":["LogicalProject(SAL=[$0], SAL_MAX=[$2], SAL_MIN=[$3], SAL_AVG=[$4], SAL_VAL=[$5], SAL_FIRST=[$6], SAL_LAST=[$7])\n LogicalAggregate(group=[{0, 1}], SAL_MAX=[MAX($0)], SAL_MIN=[MIN($0)], SAL_AVG=[AVG($0)], SAL_VAL=[ANY_VALUE($0)], SAL_FIRST=[FIRST_VALUE($0)], SAL_LAST=[LAST_VALUE($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(SAL=[$0], SAL_MAX=[$0], SAL_MIN=[$0], SAL_AVG=[$0], SAL_VAL=[$0], SAL_FIRST=[$0], SAL_LAST=[$0])\n LogicalAggregate(group=[{0, 1}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceAllAggregateFunctions.json b/tests/benchmark/testReduceAllAggregateFunctions.json new file mode 100644 index 0000000..5bf87c3 --- /dev/null +++ b/tests/benchmark/testReduceAllAggregateFunctions.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"STDDEV_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"STDDEV_SAMP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"VAR_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"VAR_SAMP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":"CAST","operand":[{"operator":"POWER","operand":[{"operator":"/","operand":[{"operator":"-","operand":[{"column":1,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"},{"operator":"0.5","operand":[],"type":"DECIMAL"}],"type":"DOUBLE"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"POWER","operand":[{"operator":"/","operand":[{"operator":"-","operand":[{"column":1,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BIGINT"},{"operator":"-","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"operator":"0.5","operand":[],"type":"DECIMAL"}],"type":"DOUBLE"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"-","operand":[{"column":1,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"-","operand":[{"column":1,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BIGINT"},{"operator":"-","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[STDDEV_SAMP($1)], EXPR$4=[VAR_POP($1)], EXPR$5=[VAR_SAMP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0], EXPR$1=[CAST(POWER(/(-($1, /(*($2, $2), $3)), $3), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[CAST(POWER(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1))), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$4=[CAST(/(-($1, /(*($2, $2), $3)), $3)):INTEGER NOT NULL], EXPR$5=[CAST(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1)))):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($2)], agg#1=[$SUM0($1)], agg#2=[COUNT()])\n LogicalProject(NAME=[$0], DEPTNO=[$1], $f2=[*($1, $1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceAverage.json b/tests/benchmark/testReduceAverage.json new file mode 100644 index 0000000..1072027 --- /dev/null +++ b/tests/benchmark/testReduceAverage.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":1,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"VARCHAR"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":1,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[MAX($0)], EXPR$2=[AVG($1)], EXPR$3=[MIN($0)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0], EXPR$1=[$0], EXPR$2=[CAST(/($1, $2)):INTEGER NOT NULL], EXPR$3=[$0])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1)], agg#1=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceAverageAndSumWithNoReduceStddevAndVar.json b/tests/benchmark/testReduceAverageAndSumWithNoReduceStddevAndVar.json new file mode 100644 index 0000000..6371da0 --- /dev/null +++ b/tests/benchmark/testReduceAverageAndSumWithNoReduceStddevAndVar.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"STDDEV_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"VAR_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"STDDEV_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"VAR_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[VAR_POP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[$4])\n LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], agg#1=[$SUM0($1)], agg#2=[COUNT()], EXPR$3=[VAR_POP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceAverageAndVarWithNoReduceStddev.json b/tests/benchmark/testReduceAverageAndVarWithNoReduceStddev.json new file mode 100644 index 0000000..d63b8b2 --- /dev/null +++ b/tests/benchmark/testReduceAverageAndVarWithNoReduceStddev.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"STDDEV_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"VAR_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"-","operand":[{"column":4,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"STDDEV_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[VAR_POP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[CAST(/(-($4, /(*($2, $2), $3)), $3)):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], agg#1=[SUM($1)], agg#2=[COUNT()], agg#3=[SUM($2)])\n LogicalProject(NAME=[$0], DEPTNO=[$1], $f2=[*($1, $1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceAverageWithNoReduceSum.json b/tests/benchmark/testReduceAverageWithNoReduceSum.json new file mode 100644 index 0000000..0edce5f --- /dev/null +++ b/tests/benchmark/testReduceAverageWithNoReduceSum.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":1,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"VARCHAR"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":1,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[MAX($0)], EXPR$2=[AVG($1)], EXPR$3=[MIN($0)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0], EXPR$1=[$0], EXPR$2=[CAST(/($1, $2)):INTEGER NOT NULL], EXPR$3=[$0])\n LogicalAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceCase.json b/tests/benchmark/testReduceCase.json new file mode 100644 index 0000000..0f4c9c1 --- /dev/null +++ b/tests/benchmark/testReduceCase.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"CASE","operand":[{"operator":"false","operand":[],"type":"BOOLEAN"},{"operator":"2.1","operand":[],"type":"FLOAT"},{"operator":"1","operand":[],"type":"FLOAT"}],"type":"FLOAT"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"1","operand":[],"type":"FLOAT"}],"source":{"scan":0}}}],"help":["LogicalProject(NEWCOL=[CASE(false, 2.1:FLOAT, 1:FLOAT)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(NEWCOL=[1E0:FLOAT])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceCaseNullabilityChange.json b/tests/benchmark/testReduceCaseNullabilityChange.json new file mode 100644 index 0000000..0185980 --- /dev/null +++ b/tests/benchmark/testReduceCaseNullabilityChange.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"IS NOT NULL","operand":[{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"CAST","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}],"help":["LogicalProject(QX=[CASE(=($0, 1), 1, IS NOT NULL(1), 2, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(QX=[CAST(CASE(=($0, 1), 1, 2)):INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceCastAndConsts.json b/tests/benchmark/testReduceCastAndConsts.json new file mode 100644 index 0000000..2a0cf5a --- /dev/null +++ b/tests/benchmark/testReduceCastAndConsts.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CAST","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"13","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"13","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=(CAST(+($0, /(10, 2))):INTEGER NOT NULL, 13)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=(+($0, 5), 13)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceCasts.json b/tests/benchmark/testReduceCasts.json new file mode 100644 index 0000000..9c3494f --- /dev/null +++ b/tests/benchmark/testReduceCasts.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"CAST","operand":[{"column":0,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"CAST","operand":[{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CAST","operand":[{"operator":"CAST","operand":[{"column":2,"type":"VARCHAR"}],"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"_ISO-8859-1'Manager'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CAST","operand":[{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"operator":"CAST","operand":[{"column":7,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}},{"project":{"target":[{"operator":"CAST","operand":[{"column":0,"type":"VARCHAR"}],"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CAST","operand":[{"operator":"CAST","operand":[{"column":2,"type":"VARCHAR"}],"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"_ISO-8859-1'Manager'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":7,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}],"help":["LogicalProject(EXPR$0=[CAST($0):VARCHAR(128) NOT NULL], EXPR$1=[CAST($1):INTEGER NOT NULL])\n LogicalFilter(condition=[=(CAST(CAST($2):VARCHAR(1) NOT NULL):VARCHAR(7) NOT NULL, 'Manager')])\n LogicalProject(NAME=[$0], EMPNO=[$2], JOB=[$3])\n LogicalJoin(condition=[=($1, $4)], joinType=[inner])\n LogicalProject(NAME=[$1], DEPTNO0=[CAST($0):INTEGER NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], JOB=[$2], DEPTNO0=[CAST($7):INTEGER NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[CAST($0):VARCHAR(128) NOT NULL], EXPR$1=[$1])\n LogicalFilter(condition=[=(CAST(CAST($2):VARCHAR(1) NOT NULL):VARCHAR(7) NOT NULL, 'Manager')])\n LogicalProject(NAME=[$0], EMPNO=[$2], JOB=[$3])\n LogicalJoin(condition=[=($1, $4)], joinType=[inner])\n LogicalProject(NAME=[$1], DEPTNO0=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], JOB=[$2], DEPTNO0=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceCompositeInSubQuery.json b/tests/benchmark/testReduceCompositeInSubQuery.json new file mode 100644 index 0000000..7f56997 --- /dev/null +++ b/tests/benchmark/testReduceCompositeInSubQuery.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IN","operand":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"query":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"column":11,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":10,"type":"INTEGER"},{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":18,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},"type":"BOOLEAN"},{"operator":"<","operand":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"40","operand":[],"type":"INTEGER"},{"operator":"60","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IN","operand":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"query":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"column":11,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":10,"type":"INTEGER"},{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":18,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},"type":"BOOLEAN"},{"operator":"<","operand":[{"column":7,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($7, +(40, 60)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($7, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstants.json b/tests/benchmark/testReduceConstants.json new file mode 100644 index 0000000..4f703c7 --- /dev/null +++ b/tests/benchmark/testReduceConstants.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"3","operand":[],"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"+","operand":[{"operator":"5","operand":[],"type":"INTEGER"},{"operator":"6","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"ROW","operand":[{"operator":"+","operand":[{"operator":"7","operand":[],"type":"INTEGER"},{"operator":"8","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"ROW"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"7","operand":[],"type":"INTEGER"},{"operator":"8","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"operator":"-","operand":[{"operator":"5","operand":[],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}},{"project":{"target":[{"operator":"3","operand":[],"type":"INTEGER"},{"operator":"22","operand":[],"type":"INTEGER"},{"operator":"26","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"ROW","operand":[{"operator":"15","operand":[],"type":"INTEGER"}],"type":"ROW"}],"source":{"values":{"schema":["INTEGER","VARCHAR","INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}}}],"help":["LogicalProject(EXPR$0=[+(1, 2)], EXPR$1=[+($0, +(3, 4))], EXPR$2=[+(+(5, 6), $0)], EXPR$3=[null:INTEGER], EXPR$4=[CASE(IS NOT NULL(2), 2, null:INTEGER)], EXPR$5=[ROW(+(7, 8))])\n LogicalFilter(condition=[AND(=($0, +(7, 8)), =($0, CASE(IS NOT NULL(2), 2, null:INTEGER)))])\n LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject($f9=[+($7, -(5, 5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[3], EXPR$1=[22], EXPR$2=[26], EXPR$3=[null:INTEGER], EXPR$4=[CAST(2):INTEGER], EXPR$5=[ROW(15)])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstants3.json b/tests/benchmark/testReduceConstants3.json new file mode 100644 index 0000000..f169671 --- /dev/null +++ b/tests/benchmark/testReduceConstants3.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["MGR"],"types":["INTEGER"],"nullable":[true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}}}},{"project":{"target":[{"operator":"IS NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}}}}],"help":["LogicalProject(EXPR$0=[OR(AND(IS NULL($0), IS NULL($1)), IS TRUE(=($0, $1)))])\n LogicalFilter(condition=[IS NULL($0)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[IS NULL($1)])\n LogicalFilter(condition=[IS NULL($0)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsCaseEquals.json b/tests/benchmark/testReduceConstantsCaseEquals.json new file mode 100644 index 0000000..8a214fd --- /dev/null +++ b/tests/benchmark/testReduceConstantsCaseEquals.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalFilter(condition=[=(CASE(=($0, 20), 2, =($0, 10), 1, 3), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsCaseEquals2.json b/tests/benchmark/testReduceConstantsCaseEquals2.json new file mode 100644 index 0000000..5144fc8 --- /dev/null +++ b/tests/benchmark/testReduceConstantsCaseEquals2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalFilter(condition=[=(CASE(=($0, 20), 2, =($0, 10), 1, null:INTEGER), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsCaseEquals3.json b/tests/benchmark/testReduceConstantsCaseEquals3.json new file mode 100644 index 0000000..4ea8465 --- /dev/null +++ b/tests/benchmark/testReduceConstantsCaseEquals3.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"111","operand":[],"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"111","operand":[],"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":0,"type":"INTEGER"},{"operator":"Sarg[10, 30]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":0,"type":"INTEGER"},{"operator":"Sarg[10, 30]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalFilter(condition=[=(CASE(=($0, 30), 1, =($0, 20), 2, =($0, 10), 1, =($0, 30), 111, 0), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalFilter(condition=[SEARCH($0, Sarg[10, 30])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsDup.json b/tests/benchmark/testReduceConstantsDup.json new file mode 100644 index 0000000..0d09647 --- /dev/null +++ b/tests/benchmark/testReduceConstantsDup.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"values":{"schema":["INTEGER"],"content":[]}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","VARCHAR"],"content":[]}}}}],"help":["LogicalValues(tuples=[[]])\n","LogicalProject(DEPTNO=[$0])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsDup2.json b/tests/benchmark/testReduceConstantsDup2.json new file mode 100644 index 0000000..6aac833 --- /dev/null +++ b/tests/benchmark/testReduceConstantsDup2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"8","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"operator":"10","operand":[],"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 7), =($7, 8), =($0, 10), IS NULL($3), =($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[10], ENAME=[$1], JOB=[$2], MGR=[null:INTEGER], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsDup3.json b/tests/benchmark/testReduceConstantsDup3.json new file mode 100644 index 0000000..323b6be --- /dev/null +++ b/tests/benchmark/testReduceConstantsDup3.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"scan":0},{"scan":0}],"help":["LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsDup3Null.json b/tests/benchmark/testReduceConstantsDup3Null.json new file mode 100644 index 0000000..ce26dff --- /dev/null +++ b/tests/benchmark/testReduceConstantsDup3Null.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","MGR"],"types":["INTEGER","INTEGER"],"nullable":[false,true],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsDupNot.json b/tests/benchmark/testReduceConstantsDupNot.json new file mode 100644 index 0000000..323b6be --- /dev/null +++ b/tests/benchmark/testReduceConstantsDupNot.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"scan":0},{"scan":0}],"help":["LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsDupNot2.json b/tests/benchmark/testReduceConstantsDupNot2.json new file mode 100644 index 0000000..323b6be --- /dev/null +++ b/tests/benchmark/testReduceConstantsDupNot2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"scan":0},{"scan":0}],"help":["LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsDupNot2Null.json b/tests/benchmark/testReduceConstantsDupNot2Null.json new file mode 100644 index 0000000..90b0074 --- /dev/null +++ b/tests/benchmark/testReduceConstantsDupNot2Null.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","MGR","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[false,true,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IS NOT NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":2,"type":"INTEGER"},{"operator":"8","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IS NOT NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":2,"type":"INTEGER"},{"operator":"8","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IS NOT NULL($1), <>($2, 8))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IS NOT NULL($1), <>($2, 8))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsDupNotNull.json b/tests/benchmark/testReduceConstantsDupNotNull.json new file mode 100644 index 0000000..ce26dff --- /dev/null +++ b/tests/benchmark/testReduceConstantsDupNotNull.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","MGR"],"types":["INTEGER","INTEGER"],"nullable":[false,true],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsEliminatesFilter.json b/tests/benchmark/testReduceConstantsEliminatesFilter.json new file mode 100644 index 0000000..15827a0 --- /dev/null +++ b/tests/benchmark/testReduceConstantsEliminatesFilter.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"operator":"+","operand":[{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"3","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}]]}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[]}}}}],"help":["LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalFilter(condition=[>(+(1, 2), +(3, null))])\n LogicalValues(tuples=[[{ 1, 2 }]])\n","LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsIsNotNull.json b/tests/benchmark/testReduceConstantsIsNotNull.json new file mode 100644 index 0000000..2336f9f --- /dev/null +++ b/tests/benchmark/testReduceConstantsIsNotNull.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}],"help":["LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsIsNull.json b/tests/benchmark/testReduceConstantsIsNull.json new file mode 100644 index 0000000..6bc0082 --- /dev/null +++ b/tests/benchmark/testReduceConstantsIsNull.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"values":{"schema":["INTEGER"],"content":[]}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}}}],"help":["LogicalValues(tuples=[[]])\n","LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsNegated.json b/tests/benchmark/testReduceConstantsNegated.json new file mode 100644 index 0000000..6bc0082 --- /dev/null +++ b/tests/benchmark/testReduceConstantsNegated.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"values":{"schema":["INTEGER"],"content":[]}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}}}],"help":["LogicalValues(tuples=[[]])\n","LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsNegatedInverted.json b/tests/benchmark/testReduceConstantsNegatedInverted.json new file mode 100644 index 0000000..6bc0082 --- /dev/null +++ b/tests/benchmark/testReduceConstantsNegatedInverted.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"values":{"schema":["INTEGER"],"content":[]}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}}}],"help":["LogicalValues(tuples=[[]])\n","LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsNull.json b/tests/benchmark/testReduceConstantsNull.json new file mode 100644 index 0000000..19ab407 --- /dev/null +++ b/tests/benchmark/testReduceConstantsNull.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"IS NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"IS NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}],"help":["LogicalFilter(condition=[IS NULL($0)])\n LogicalFilter(condition=[IS NULL($0)])\n LogicalProject(N=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(N=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsNullEqualsOne.json b/tests/benchmark/testReduceConstantsNullEqualsOne.json new file mode 100644 index 0000000..42f3e15 --- /dev/null +++ b/tests/benchmark/testReduceConstantsNullEqualsOne.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"values":{"schema":["INTEGER"],"content":[]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER"],"content":[]}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"values":{"schema":["INTEGER"],"content":[]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER"],"content":[]}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalValues(tuples=[[]])\n","LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsProjectNullable.json b/tests/benchmark/testReduceConstantsProjectNullable.json new file mode 100644 index 0000000..4e9c764 --- /dev/null +++ b/tests/benchmark/testReduceConstantsProjectNullable.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["MGR"],"types":["INTEGER"],"nullable":[true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"project":{"target":[{"operator":"CAST","operand":[{"operator":"10","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(MGR=[CAST(10):INTEGER])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsRequiresExecutor.json b/tests/benchmark/testReduceConstantsRequiresExecutor.json new file mode 100644 index 0000000..15827a0 --- /dev/null +++ b/tests/benchmark/testReduceConstantsRequiresExecutor.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"operator":"+","operand":[{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"3","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}]]}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[]}}}}],"help":["LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalFilter(condition=[>(+(1, 2), +(3, null))])\n LogicalValues(tuples=[[{ 1, 2 }]])\n","LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceDynamic.json b/tests/benchmark/testReduceDynamic.json new file mode 100644 index 0000000..267d76a --- /dev/null +++ b/tests/benchmark/testReduceDynamic.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"USER","operand":[],"type":"VARCHAR"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"_ISO-8859-1'happyCalciteUser'","operand":[],"type":"VARCHAR"}],"source":{"scan":0}}}],"help":["LogicalProject(USER=[USER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(USER=['happyCalciteUser':VARCHAR(2000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceNestedCaseWhen.json b/tests/benchmark/testReduceNestedCaseWhen.json new file mode 100644 index 0000000..f5818b5 --- /dev/null +++ b/tests/benchmark/testReduceNestedCaseWhen.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"2000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":0,"type":"INTEGER"},{"operator":"Sarg[1000, 2000]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}],"help":["LogicalFilter(condition=[OR(AND(=($0, 1000), IS NULL(CASE(=($0, 1000), null:INTEGER, 1))), AND(IS NULL(CASE(=($0, 2000), null:INTEGER, 1)), <>($0, 1000)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalFilter(condition=[SEARCH($0, Sarg[1000, 2000])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceNullableToNotNull.json b/tests/benchmark/testReduceNullableToNotNull.json new file mode 100644 index 0000000..0744c3d --- /dev/null +++ b/tests/benchmark/testReduceNullableToNotNull.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"operator":"_ISO-8859-1'a'","operand":[],"type":"CHAR"},{"operator":"_ISO-8859-1'a'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}],"help":["LogicalProject(NEWCOL=[+($0, CASE(=('a', 'a'), 1, null:INTEGER))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(NEWCOL=[+($0, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceNullableToNotNull2.json b/tests/benchmark/testReduceNullableToNotNull2.json new file mode 100644 index 0000000..0744c3d --- /dev/null +++ b/tests/benchmark/testReduceNullableToNotNull2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"operator":"_ISO-8859-1'a'","operand":[],"type":"CHAR"},{"operator":"_ISO-8859-1'a'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}],"help":["LogicalProject(NEWCOL=[+($0, CASE(=('a', 'a'), 1, null:INTEGER))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(NEWCOL=[+($0, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceOrCaseWhen.json b/tests/benchmark/testReduceOrCaseWhen.json new file mode 100644 index 0000000..d837933 --- /dev/null +++ b/tests/benchmark/testReduceOrCaseWhen.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IS NULL","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"2000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":0,"type":"INTEGER"},{"operator":"Sarg[1000, 2000]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}],"help":["LogicalFilter(condition=[OR(IS NULL(CASE(=($0, 1000), null:INTEGER, 1)), IS NULL(CASE(=($0, 2000), null:INTEGER, 1)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalFilter(condition=[SEARCH($0, Sarg[1000, 2000])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceValuesToEmpty.json b/tests/benchmark/testReduceValuesToEmpty.json new file mode 100644 index 0000000..f7406f9 --- /dev/null +++ b/tests/benchmark/testReduceValuesToEmpty.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"operator":"-","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}]]}}}}}},{"values":{"schema":["INTEGER","INTEGER","INTEGER"],"content":[]}}],"help":["LogicalProject(X=[+($0, $1)], B=[$1], A=[$0])\n LogicalFilter(condition=[<(-($0, $1), 0)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 7 }]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceValuesUnderFilter.json b/tests/benchmark/testReduceValuesUnderFilter.json new file mode 100644 index 0000000..be2e7be --- /dev/null +++ b/tests/benchmark/testReduceValuesUnderFilter.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"CHAR"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"15","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","CHAR"],"content":[[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"_ISO-8859-1'x'","operand":[],"type":"CHAR"}],[{"operator":"20","operand":[],"type":"INTEGER"},{"operator":"_ISO-8859-1'y'","operand":[],"type":"CHAR"}]]}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"CHAR"}],"source":{"values":{"schema":["INTEGER","CHAR"],"content":[[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"_ISO-8859-1'x'","operand":[],"type":"CHAR"}]]}}}}],"help":["LogicalProject(A=[$0], B=[$1])\n LogicalFilter(condition=[<($0, 15)])\n LogicalValues(tuples=[[{ 10, 'x' }, { 20, 'y' }]])\n","LogicalProject(A=[$0], B=[$1])\n LogicalValues(tuples=[[{ 10, 'x' }]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceValuesUnderProject.json b/tests/benchmark/testReduceValuesUnderProject.json new file mode 100644 index 0000000..c94adff --- /dev/null +++ b/tests/benchmark/testReduceValuesUnderProject.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],[{"operator":"20","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}},{"values":{"schema":["INTEGER"],"content":[[{"operator":"11","operand":[],"type":"INTEGER"}],[{"operator":"23","operand":[],"type":"INTEGER"}]]}}],"help":["LogicalProject(EXPR$0=[+($0, $1)])\n LogicalValues(tuples=[[{ 10, 1 }, { 20, 3 }]])\n","LogicalValues(tuples=[[{ 11 }, { 23 }]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceValuesUnderProjectFilter.json b/tests/benchmark/testReduceValuesUnderProjectFilter.json new file mode 100644 index 0000000..503ce65 --- /dev/null +++ b/tests/benchmark/testReduceValuesUnderProjectFilter.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"operator":"-","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"21","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],[{"operator":"20","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}}}},{"values":{"schema":["INTEGER","INTEGER","INTEGER"],"content":[[{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],[{"operator":"23","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}]]}}],"help":["LogicalProject(X=[+($0, $1)], B=[$1], A=[$0])\n LogicalFilter(condition=[<(-($0, $1), 21)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 7 }, { 20, 3 }]])\n","LogicalValues(tuples=[[{ 11, 1, 10 }, { 23, 3, 20 }]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceWithNonTypePredicate.json b/tests/benchmark/testReduceWithNonTypePredicate.json new file mode 100644 index 0000000..bfc5cd0 --- /dev/null +++ b/tests/benchmark/testReduceWithNonTypePredicate.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[AVG($0)], EXPR$1=[AVG($0) WITHIN DISTINCT ($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$0], EXPR$1=[CAST(/(CASE(=($2, 0), null:INTEGER, $1), $2)):INTEGER])\n LogicalAggregate(group=[{}], EXPR$0=[AVG($0)], agg#1=[$SUM0($0) WITHIN DISTINCT ($1)], agg#2=[COUNT() WITHIN DISTINCT ($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRemoveDistinctOnAgg.json b/tests/benchmark/testRemoveDistinctOnAgg.json new file mode 100644 index 0000000..6ab1221 --- /dev/null +++ b/tests/benchmark/testRemoveDistinctOnAgg.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"BIT_AND","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"BIT_OR","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":4,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":"1","operand":[],"type":"BIGINT"}],"source":{"scan":0}}}],"help":["LogicalProject(EMPNO=[$0], EXPR$1=[$2], EXPR$2=[$3], EXPR$3=[$3], EXPR$4=[$4], EXPR$5=[$5], EXPR$6=[$6], EXPR$7=[$7])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM(DISTINCT $2)], EXPR$2=[MIN($2)], EXPR$4=[MAX($2)], EXPR$5=[BIT_AND($2)], EXPR$6=[BIT_OR($2)], EXPR$7=[COUNT(DISTINCT $2)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], EXPR$1=[$5], EXPR$2=[$5], EXPR$3=[$5], EXPR$4=[$5], EXPR$5=[$5], EXPR$6=[$5], EXPR$7=[1:BIGINT])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRemoveSemiJoin.json b/tests/benchmark/testRemoveSemiJoin.json new file mode 100644 index 0000000..f800818 --- /dev/null +++ b/tests/benchmark/testRemoveSemiJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}],"help":["LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[=($1, $2)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(ENAME=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRemoveSemiJoinRight.json b/tests/benchmark/testRemoveSemiJoinRight.json new file mode 100644 index 0000000..f3ef9a5 --- /dev/null +++ b/tests/benchmark/testRemoveSemiJoinRight.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}],"help":["LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[AND(=($1, $2), =($2, $3))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(ENAME=[$0])\n LogicalJoin(condition=[=($2, $3)], joinType=[inner])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRemoveSemiJoinRightWithFilter.json b/tests/benchmark/testRemoveSemiJoinRightWithFilter.json new file mode 100644 index 0000000..a6384de --- /dev/null +++ b/tests/benchmark/testRemoveSemiJoinRightWithFilter.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'foo'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'foo'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":1}}}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}],"help":["LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[AND(=($1, $2), =($2, $4), =($3, 'foo'))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(ENAME=[$0])\n LogicalJoin(condition=[=($2, $4)], joinType=[inner])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($1, 'foo')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRemoveSemiJoinWithFilter.json b/tests/benchmark/testRemoveSemiJoinWithFilter.json new file mode 100644 index 0000000..f70a42a --- /dev/null +++ b/tests/benchmark/testRemoveSemiJoinWithFilter.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'foo'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'foo'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[AND(=($1, $2), =($0, 'foo'))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(ENAME=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalFilter(condition=[=($0, 'foo')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRightEmptyAntiJoin.json b/tests/benchmark/testRightEmptyAntiJoin.json new file mode 100644 index 0000000..8a0a3be --- /dev/null +++ b/tests/benchmark/testRightEmptyAntiJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["SMALLINT","TINYINT"],"nullable":[false,true],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"join":{"kind":"ANTI","condition":{"operator":"=","operand":[{"column":1,"type":"TINYINT"},{"column":2,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"values":{"schema":["TINYINT","VARCHAR","VARCHAR"],"content":[]}}}}}},{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"scan":0}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[anti])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n","LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[scott, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRightEmptyAntiJoinNonEqui.json b/tests/benchmark/testRightEmptyAntiJoinNonEqui.json new file mode 100644 index 0000000..1c4a3be --- /dev/null +++ b/tests/benchmark/testRightEmptyAntiJoinNonEqui.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","SAL","DEPTNO"],"types":["SMALLINT","DECIMAL","TINYINT"],"nullable":[false,true,true],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"join":{"kind":"ANTI","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"TINYINT"},{"column":3,"type":"TINYINT"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"DECIMAL"},{"operator":"2000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"values":{"schema":["TINYINT","VARCHAR","VARCHAR"],"content":[]}}}}}},{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"scan":0}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[AND(=($2, $3), =($1, 2000))], joinType=[anti])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n","LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[scott, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRightEmptyFullJoin.json b/tests/benchmark/testRightEmptyFullJoin.json new file mode 100644 index 0000000..617c8e1 --- /dev/null +++ b/tests/benchmark/testRightEmptyFullJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"values":{"schema":["INTEGER","VARCHAR"],"content":[]}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRightEmptyInnerJoin.json b/tests/benchmark/testRightEmptyInnerJoin.json new file mode 100644 index 0000000..620b954 --- /dev/null +++ b/tests/benchmark/testRightEmptyInnerJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN","INTEGER","VARCHAR"],"content":[]}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRightEmptyLeftJoin.json b/tests/benchmark/testRightEmptyLeftJoin.json new file mode 100644 index 0000000..53550a2 --- /dev/null +++ b/tests/benchmark/testRightEmptyLeftJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"values":{"schema":["INTEGER","VARCHAR"],"content":[]}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRightEmptyRightJoin.json b/tests/benchmark/testRightEmptyRightJoin.json new file mode 100644 index 0000000..a4c604e --- /dev/null +++ b/tests/benchmark/testRightEmptyRightJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN","INTEGER","VARCHAR"],"content":[]}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRightEmptySemiJoin.json b/tests/benchmark/testRightEmptySemiJoin.json new file mode 100644 index 0000000..aae9efc --- /dev/null +++ b/tests/benchmark/testRightEmptySemiJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["SMALLINT","TINYINT"],"nullable":[false,true],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":1,"type":"TINYINT"},{"column":2,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"values":{"schema":["TINYINT","VARCHAR","VARCHAR"],"content":[]}}}}}},{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"values":{"schema":["SMALLINT","VARCHAR","VARCHAR","SMALLINT","DATE","DECIMAL","DECIMAL","TINYINT"],"content":[]}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n","LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRightOuterJoinSimplificationToInner.json b/tests/benchmark/testRightOuterJoinSimplificationToInner.json new file mode 100644 index 0000000..8c6b5e2 --- /dev/null +++ b/tests/benchmark/testRightOuterJoinSimplificationToInner.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSemiJoinProjectTranspose.json b/tests/benchmark/testSemiJoinProjectTranspose.json new file mode 100644 index 0000000..d814801 --- /dev/null +++ b/tests/benchmark/testSemiJoinProjectTranspose.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","DNAME","LOC"],"types":["TINYINT","VARCHAR","VARCHAR"],"nullable":[false,true,true],"key":[[0],[1],[2]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","DNAME","LOC"],"types":["TINYINT","VARCHAR","VARCHAR"],"nullable":[false,true,true],"key":[[0],[1],[2]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"TINYINT"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":0,"type":"TINYINT"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":1,"type":"TINYINT"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}},{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"TINYINT"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":0,"type":"TINYINT"}],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":1,"type":"TINYINT"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}],"help":["LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n","LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSemiJoinReduceConstants.json b/tests/benchmark/testSemiJoinReduceConstants.json new file mode 100644 index 0000000..4d1bde3 --- /dev/null +++ b/tests/benchmark/testSemiJoinReduceConstants.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"200","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"operator":"200","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"200","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(SAL=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\n LogicalFilter(condition=[=($1, 200)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[=($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(SAL=[$0])\n LogicalJoin(condition=[=(200, $2)], joinType=[semi])\n LogicalFilter(condition=[=($1, 200)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[=($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSemiJoinRule.json b/tests/benchmark/testSemiJoinRule.json new file mode 100644 index 0000000..5957a85 --- /dev/null +++ b/tests/benchmark/testSemiJoinRule.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}}]}}}}}},{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}],"help":["LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSemiJoinRuleExists.json b/tests/benchmark/testSemiJoinRuleExists.json new file mode 100644 index 0000000..5957a85 --- /dev/null +++ b/tests/benchmark/testSemiJoinRuleExists.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}}]}}}}}},{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}],"help":["LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSemiJoinRuleLeft.json b/tests/benchmark/testSemiJoinRuleLeft.json new file mode 100644 index 0000000..936a48e --- /dev/null +++ b/tests/benchmark/testSemiJoinRuleLeft.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}}]}}}}}},{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}],"help":["LogicalProject(NAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSemiJoinRuleWithHint.json b/tests/benchmark/testSemiJoinRuleWithHint.json new file mode 100644 index 0000000..295baa2 --- /dev/null +++ b/tests/benchmark/testSemiJoinRuleWithHint.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","DNAME"],"types":["TINYINT","VARCHAR"],"nullable":[false,true],"key":[[0],[1]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["TINYINT"],"nullable":[true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":2,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"TINYINT"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":1,"type":"TINYINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}},{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":2,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}],"help":["LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[scott, EMP]])\n","LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSemiJoinRuleWithJoinOnUniqueInput.json b/tests/benchmark/testSemiJoinRuleWithJoinOnUniqueInput.json new file mode 100644 index 0000000..47d911c --- /dev/null +++ b/tests/benchmark/testSemiJoinRuleWithJoinOnUniqueInput.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSemiJoinTrim.json b/tests/benchmark/testSemiJoinTrim.json new file mode 100644 index 0000000..2184774 --- /dev/null +++ b/tests/benchmark/testSemiJoinTrim.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"ACCOUNT","fields":["ACCTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}},"right":{"scan":2}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}},"right":{"scan":2}}}}}],"help":["LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalJoin(condition=[=($0, $1)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, CUSTOMER, ACCOUNT]])\n","LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalJoin(condition=[=($0, $1)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, CUSTOMER, ACCOUNT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSimplifyFilter.json b/tests/benchmark/testSimplifyFilter.json new file mode 100644 index 0000000..e688d85 --- /dev/null +++ b/tests/benchmark/testSimplifyFilter.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(>($0, 3), >($7, 5))])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>($0, 3)])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSkipReduceConstantsCaseEquals.json b/tests/benchmark/testSkipReduceConstantsCaseEquals.json new file mode 100644 index 0000000..c48b457 --- /dev/null +++ b/tests/benchmark/testSkipReduceConstantsCaseEquals.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"-1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":12,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"-1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"-1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":12,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"-1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalFilter(condition=[=(CASE(IS NOT NULL($3), CAST($3):INTEGER NOT NULL, -1), CASE(IS NOT NULL($12), CAST($12):INTEGER NOT NULL, -1))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[=(CASE(IS NOT NULL($3), CAST($3):INTEGER NOT NULL, -1), CASE(IS NOT NULL($12), CAST($12):INTEGER NOT NULL, -1))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSome.json b/tests/benchmark/testSome.json new file mode 100644 index 0000000..b2891b5 --- /dev/null +++ b/tests/benchmark/testSome.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"> SOME","operand":[{"column":0,"type":"INTEGER"}],"query":{"scan":1},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":10,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":10,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<=","operand":[{"column":10,"type":"BIGINT"},{"column":11,"type":"BIGINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BIGINT"},{"column":1,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[> SOME($0, {\nLogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(AND(>($0, $9), <>($10, 0)), AND(>($0, $9), <>($10, 0), IS NOT TRUE(>($0, $9)), <=($10, $11)))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(m=[$0], c=[$1], d=[$1])\n LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSomeWithEquality.json b/tests/benchmark/testSomeWithEquality.json new file mode 100644 index 0000000..e500a9f --- /dev/null +++ b/tests/benchmark/testSomeWithEquality.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IN","operand":[{"column":7,"type":"INTEGER"}],"query":{"scan":1},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IN($7, {\nLogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSomeWithEquality2.json b/tests/benchmark/testSomeWithEquality2.json new file mode 100644 index 0000000..da30b99 --- /dev/null +++ b/tests/benchmark/testSomeWithEquality2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IN","operand":[{"column":1,"type":"VARCHAR"}],"query":{"scan":1},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":9,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IN($1, {\nLogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($1, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSomeWithNotEquality.json b/tests/benchmark/testSomeWithNotEquality.json new file mode 100644 index 0000000..31236f3 --- /dev/null +++ b/tests/benchmark/testSomeWithNotEquality.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<> SOME","operand":[{"column":7,"type":"INTEGER"}],"query":{"scan":1},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"<>","operand":[{"column":10,"type":"BIGINT"},{"column":9,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"<=","operand":[{"column":10,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":7,"type":"INTEGER"},{"column":11,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":9,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":10,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":7,"type":"INTEGER"},{"column":11,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":9,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"OR","operand":[{"operator":"=","operand":[{"column":10,"type":"BIGINT"},{"column":9,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":10,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"<>","operand":[{"column":9,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"OR","operand":[{"operator":"=","operand":[{"column":10,"type":"BIGINT"},{"column":9,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":10,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":10,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"BIGINT"},{"column":0,"type":"BIGINT"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MAX","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[<> SOME($7, {\nLogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(AND(<>($10, $9), <=($10, 1), <>($7, $11), <>($9, 0)), AND(=($10, 1), <>($7, $11), <>($9, 0), OR(=($10, $9), >($10, 1))), AND(<>($9, 0), OR(=($10, $9), >($10, 1)), <>($10, 1)))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(c=[$0], d=[$0], m=[$1])\n LogicalAggregate(group=[{}], c=[COUNT()], m=[MAX($0)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinCopyInnerJoinOrderBy.json b/tests/benchmark/testSortJoinCopyInnerJoinOrderBy.json new file mode 100644 index 0000000..b94baec --- /dev/null +++ b/tests/benchmark/testSortJoinCopyInnerJoinOrderBy.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[5,"INTEGER","ASC"]],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[5,"INTEGER","ASC"]],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"sort":{"collation":[[5,"INTEGER","ASC"]],"source":{"scan":0}}},"right":{"scan":1}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinCopyInnerJoinOrderByLimit.json b/tests/benchmark/testSortJoinCopyInnerJoinOrderByLimit.json new file mode 100644 index 0000000..b2cb5ff --- /dev/null +++ b/tests/benchmark/testSortJoinCopyInnerJoinOrderByLimit.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[5,"INTEGER","ASC"]],"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[5,"INTEGER","ASC"]],"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"sort":{"collation":[[5,"INTEGER","ASC"]],"source":{"scan":0}}},"right":{"scan":1}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinCopyInnerJoinOrderByTwoFields.json b/tests/benchmark/testSortJoinCopyInnerJoinOrderByTwoFields.json new file mode 100644 index 0000000..518da19 --- /dev/null +++ b/tests/benchmark/testSortJoinCopyInnerJoinOrderByTwoFields.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[5,"INTEGER","ASC"],[10,"VARCHAR","ASC"]],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[5,"INTEGER","ASC"],[10,"VARCHAR","ASC"]],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"sort":{"collation":[[5,"INTEGER","ASC"]],"source":{"scan":0}}},"right":{"sort":{"collation":[[1,"VARCHAR","ASC"]],"source":{"scan":1}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], sort1=[$10], dir0=[ASC], dir1=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], sort1=[$10], dir0=[ASC], dir1=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalSort(sort0=[$1], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinCopySemiJoinOrderBy.json b/tests/benchmark/testSortJoinCopySemiJoinOrderBy.json new file mode 100644 index 0000000..c8dddf4 --- /dev/null +++ b/tests/benchmark/testSortJoinCopySemiJoinOrderBy.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[0,"INTEGER","ASC"]],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"sort":{"collation":[[0,"INTEGER","ASC"]],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"sort":{"collation":[[0,"INTEGER","ASC"]],"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinCopySemiJoinOrderByLimitOffset.json b/tests/benchmark/testSortJoinCopySemiJoinOrderByLimitOffset.json new file mode 100644 index 0000000..7f03af5 --- /dev/null +++ b/tests/benchmark/testSortJoinCopySemiJoinOrderByLimitOffset.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[0,"INTEGER","ASC"]],"offset":{"operator":"2","operand":[],"type":"INTEGER"},"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"sort":{"collation":[[0,"INTEGER","ASC"]],"offset":{"operator":"2","operand":[],"type":"INTEGER"},"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"sort":{"collation":[[0,"INTEGER","ASC"]],"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalSort(sort0=[$0], dir0=[ASC], offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalSort(sort0=[$0], dir0=[ASC], offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinCopySemiJoinOrderByOffset.json b/tests/benchmark/testSortJoinCopySemiJoinOrderByOffset.json new file mode 100644 index 0000000..535c170 --- /dev/null +++ b/tests/benchmark/testSortJoinCopySemiJoinOrderByOffset.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[0,"INTEGER","ASC"]],"offset":{"operator":"2","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"sort":{"collation":[[0,"INTEGER","ASC"]],"offset":{"operator":"2","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"sort":{"collation":[[0,"INTEGER","ASC"]],"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalSort(sort0=[$0], dir0=[ASC], offset=[2])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalSort(sort0=[$0], dir0=[ASC], offset=[2])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinTranspose1.json b/tests/benchmark/testSortJoinTranspose1.json new file mode 100644 index 0000000..f051959 --- /dev/null +++ b/tests/benchmark/testSortJoinTranspose1.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[5,"INTEGER","ASC"]],"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[5,"INTEGER","ASC"]],"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"sort":{"collation":[[5,"INTEGER","ASC"]],"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"scan":0}}},"right":{"scan":1}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinTranspose2.json b/tests/benchmark/testSortJoinTranspose2.json new file mode 100644 index 0000000..2929585 --- /dev/null +++ b/tests/benchmark/testSortJoinTranspose2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[10,"VARCHAR","ASC"]],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[10,"VARCHAR","ASC"]],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"sort":{"collation":[[1,"VARCHAR","ASC"]],"source":{"scan":1}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalSort(sort0=[$1], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinTranspose4.json b/tests/benchmark/testSortJoinTranspose4.json new file mode 100644 index 0000000..2929585 --- /dev/null +++ b/tests/benchmark/testSortJoinTranspose4.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[10,"VARCHAR","ASC"]],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[10,"VARCHAR","ASC"]],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"sort":{"collation":[[1,"VARCHAR","ASC"]],"source":{"scan":1}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalSort(sort0=[$1], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinTranspose6.json b/tests/benchmark/testSortJoinTranspose6.json new file mode 100644 index 0000000..5837004 --- /dev/null +++ b/tests/benchmark/testSortJoinTranspose6.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"sort":{"collation":[],"offset":{"operator":"2","operand":[],"type":"INTEGER"},"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"sort":{"collation":[],"offset":{"operator":"2","operand":[],"type":"INTEGER"},"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"sort":{"collation":[],"offset":{"operator":"2","operand":[],"type":"INTEGER"},"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"scan":1}}}}}}}}}],"help":["LogicalProject(DEPTNO=[$0], EMPNO=[$1])\n LogicalSort(offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EMPNO=[$1])\n LogicalSort(offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalSort(offset=[2], fetch=[10])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortProjectTranspose1.json b/tests/benchmark/testSortProjectTranspose1.json new file mode 100644 index 0000000..4f59319 --- /dev/null +++ b/tests/benchmark/testSortProjectTranspose1.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[1,"INTEGER","ASC"]],"offset":{"operator":"1","operand":[],"type":"INTEGER"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"sort":{"collation":[[0,"INTEGER","ASC"]],"offset":{"operator":"1","operand":[],"type":"INTEGER"},"source":{"scan":0}}}}}],"help":["LogicalSort(sort0=[$1], dir0=[ASC], offset=[1])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[$0])\n LogicalSort(sort0=[$0], dir0=[ASC], offset=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortProjectTranspose2.json b/tests/benchmark/testSortProjectTranspose2.json new file mode 100644 index 0000000..34aa6d5 --- /dev/null +++ b/tests/benchmark/testSortProjectTranspose2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[1,"DOUBLE","ASC"]],"offset":{"operator":"1","operand":[],"type":"INTEGER"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CAST","operand":[{"column":0,"type":"INTEGER"}],"type":"DOUBLE"}],"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CAST","operand":[{"column":0,"type":"INTEGER"}],"type":"DOUBLE"}],"source":{"sort":{"collation":[[0,"INTEGER","ASC"]],"offset":{"operator":"1","operand":[],"type":"INTEGER"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}],"help":["LogicalSort(sort0=[$1], dir0=[ASC], offset=[1])\n LogicalProject(DEPTNO=[$0], EXPR$1=[CAST($0):DOUBLE NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[CAST($0):DOUBLE NOT NULL])\n LogicalSort(sort0=[$0], dir0=[ASC], offset=[1])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortRemovalAllKeysConstant.json b/tests/benchmark/testSortRemovalAllKeysConstant.json new file mode 100644 index 0000000..e19fc72 --- /dev/null +++ b/tests/benchmark/testSortRemovalAllKeysConstant.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[1,"INTEGER","DESC-nulls-last"]],"source":{"project":{"target":[{"column":2,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}},{"project":{"target":[{"column":2,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}],"help":["LogicalSort(sort0=[$1], dir0=[DESC-nulls-last])\n LogicalProject(C=[$2], DEPTNO=[$0])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$1], SAL=[$0])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(C=[$2], DEPTNO=[$0])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$1], SAL=[$0])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortRemovalOneKeyConstant.json b/tests/benchmark/testSortRemovalOneKeyConstant.json new file mode 100644 index 0000000..1ee2b6a --- /dev/null +++ b/tests/benchmark/testSortRemovalOneKeyConstant.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[1,"INTEGER","ASC"],[2,"INTEGER","DESC"]],"source":{"project":{"target":[{"column":2,"type":"BIGINT"},{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}},{"sort":{"collation":[[2,"INTEGER","DESC"]],"source":{"project":{"target":[{"column":2,"type":"BIGINT"},{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}}],"help":["LogicalSort(sort0=[$1], sort1=[$2], dir0=[ASC], dir1=[DESC])\n LogicalProject(C=[$2], DEPTNO=[$0], SAL=[$1])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$1], SAL=[$0])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalSort(sort0=[$2], dir0=[DESC])\n LogicalProject(C=[$2], DEPTNO=[$0], SAL=[$1])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$1], SAL=[$0])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortUnionTranspose.json b/tests/benchmark/testSortUnionTranspose.json new file mode 100644 index 0000000..da2d9c2 --- /dev/null +++ b/tests/benchmark/testSortUnionTranspose.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[0,"VARCHAR","ASC"]],"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"union":[{"scan":0},{"scan":0}]}}},{"sort":{"collation":[[0,"VARCHAR","ASC"]],"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"union":[{"sort":{"collation":[[0,"VARCHAR","ASC"]],"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"scan":0}}},{"sort":{"collation":[[0,"VARCHAR","ASC"]],"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"scan":0}}}]}}}],"help":["LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalUnion(all=[true])\n LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortUnionTranspose2.json b/tests/benchmark/testSortUnionTranspose2.json new file mode 100644 index 0000000..a976faa --- /dev/null +++ b/tests/benchmark/testSortUnionTranspose2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[0,"VARCHAR","ASC"]],"source":{"union":[{"scan":0},{"scan":0}]}}},{"sort":{"collation":[[0,"VARCHAR","ASC"]],"source":{"union":[{"sort":{"collation":[[0,"VARCHAR","ASC"]],"source":{"scan":0}}},{"sort":{"collation":[[0,"VARCHAR","ASC"]],"source":{"scan":0}}}]}}}],"help":["LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalUnion(all=[true])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortUnionTranspose3.json b/tests/benchmark/testSortUnionTranspose3.json new file mode 100644 index 0000000..9bba2c7 --- /dev/null +++ b/tests/benchmark/testSortUnionTranspose3.json @@ -0,0 +1 @@ +{"schemas":[],"queries":[{"values":{"schema":["VARCHAR"],"content":[]}},{"values":{"schema":["VARCHAR"],"content":[]}}],"help":["LogicalValues(tuples=[[]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSpatialContainsPoint.json b/tests/benchmark/testSpatialContainsPoint.json new file mode 100644 index 0000000..4d15ff0 --- /dev/null +++ b/tests/benchmark/testSpatialContainsPoint.json @@ -0,0 +1 @@ +{"schemas":[{"name":"RESTAURANTS","fields":["NAME","LATITUDE","LONGITUDE","CUISINE","HILBERT"],"types":["VARCHAR","INTEGER","INTEGER","VARCHAR","BIGINT"],"nullable":[false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"ST_CONTAINS","operand":[{"operator":"ST_BUFFER","operand":[{"operator":"ST_POINT","operand":[{"operator":"10.0","operand":[],"type":"DECIMAL"},{"operator":"20.0","operand":[],"type":"DECIMAL"}],"type":"GEOMETRY"},{"operator":"6","operand":[],"type":"INTEGER"}],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"SEARCH","operand":[{"column":4,"type":"BIGINT"},{"operator":"Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"ST_CONTAINS","operand":[{"operator":"POLYGON ((16 20, 15.884711682419383 18.829458067903232, 15.54327719506772 17.703899405809462, 14.988817673815271 16.666578601882385, 14.242640687119286 15.757359312880716, 13.333421398117615 15.011182326184729, 12.29610059419054 14.45672280493228, 11.17054193209677 14.115288317580617, 10 14, 8.82945806790323 14.115288317580617, 7.703899405809461 14.45672280493228, 6.666578601882389 15.011182326184727, 5.757359312880715 15.757359312880714, 5.011182326184728 16.666578601882385, 4.45672280493228 17.70389940580946, 4.115288317580617 18.82945806790323, 4 20, 4.115288317580617 21.17054193209677, 4.456722804932279 22.296100594190538, 5.011182326184727 23.33342139811761, 5.757359312880714 24.242640687119284, 6.666578601882387 24.98881767381527, 7.703899405809458 25.54327719506772, 8.829458067903229 25.884711682419383, 9.999999999999998 26, 11.17054193209677 25.884711682419383, 12.29610059419054 25.54327719506772, 13.333421398117611 24.988817673815273, 14.242640687119284 24.242640687119284, 14.988817673815271 23.333421398117615, 15.54327719506772 22.29610059419054, 15.884711682419383 21.17054193209677, 16 20))","operand":[],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_CONTAINS(ST_BUFFER(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), 6), ST_POINT($2, $1))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n","LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]), ST_CONTAINS(POLYGON ((16 20, 15.884711682419383 18.829458067903232, 15.54327719506772 17.703899405809462, 14.988817673815271 16.666578601882385, 14.242640687119286 15.757359312880716, 13.333421398117615 15.011182326184729, 12.29610059419054 14.45672280493228, 11.17054193209677 14.115288317580617, 10 14, 8.82945806790323 14.115288317580617, 7.703899405809461 14.45672280493228, 6.666578601882389 15.011182326184727, 5.757359312880715 15.757359312880714, 5.011182326184728 16.666578601882385, 4.45672280493228 17.70389940580946, 4.115288317580617 18.82945806790323, 4 20, 4.115288317580617 21.17054193209677, 4.456722804932279 22.296100594190538, 5.011182326184727 23.33342139811761, 5.757359312880714 24.242640687119284, 6.666578601882387 24.98881767381527, 7.703899405809458 25.54327719506772, 8.829458067903229 25.884711682419383, 9.999999999999998 26, 11.17054193209677 25.884711682419383, 12.29610059419054 25.54327719506772, 13.333421398117611 24.988817673815273, 14.242640687119284 24.242640687119284, 14.988817673815271 23.333421398117615, 15.54327719506772 22.29610059419054, 15.884711682419383 21.17054193209677, 16 20)):GEOMETRY, ST_POINT($2, $1)))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSpatialDWithinLine.json b/tests/benchmark/testSpatialDWithinLine.json new file mode 100644 index 0000000..cf2d993 --- /dev/null +++ b/tests/benchmark/testSpatialDWithinLine.json @@ -0,0 +1 @@ +{"schemas":[{"name":"RESTAURANTS","fields":["NAME","LATITUDE","LONGITUDE","CUISINE","HILBERT"],"types":["VARCHAR","INTEGER","INTEGER","VARCHAR","BIGINT"],"nullable":[false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"ST_DWITHIN","operand":[{"operator":"ST_MAKELINE","operand":[{"operator":"ST_POINT","operand":[{"operator":"8.0","operand":[],"type":"DECIMAL"},{"operator":"20.0","operand":[],"type":"DECIMAL"}],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"operator":"12.0","operand":[],"type":"DECIMAL"},{"operator":"20.0","operand":[],"type":"DECIMAL"}],"type":"GEOMETRY"}],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"SEARCH","operand":[{"column":4,"type":"BIGINT"},{"operator":"Sarg[[33064..33076], [33092..33100], [33112..33156], [33164..33176], [33236..33240], [36457..36459], [36501..36503], [36505..36507], [36517..36519]]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"ST_DWITHIN","operand":[{"operator":"LINESTRING (8 20, 12 20)","operand":[],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_MAKELINE(ST_POINT(8.0:DECIMAL(2, 1), 20.0:DECIMAL(3, 1)), ST_POINT(12.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1))), ST_POINT($2, $1), 4)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n","LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[33064..33076], [33092..33100], [33112..33156], [33164..33176], [33236..33240], [36457..36459], [36501..36503], [36505..36507], [36517..36519]]), ST_DWITHIN(LINESTRING (8 20, 12 20):GEOMETRY, ST_POINT($2, $1), 4))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSpatialDWithinReversed.json b/tests/benchmark/testSpatialDWithinReversed.json new file mode 100644 index 0000000..af852a6 --- /dev/null +++ b/tests/benchmark/testSpatialDWithinReversed.json @@ -0,0 +1 @@ +{"schemas":[{"name":"RESTAURANTS","fields":["NAME","LATITUDE","LONGITUDE","CUISINE","HILBERT"],"types":["VARCHAR","INTEGER","INTEGER","VARCHAR","BIGINT"],"nullable":[false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"ST_DWITHIN","operand":[{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"operator":"10.0","operand":[],"type":"DECIMAL"},{"operator":"20.0","operand":[],"type":"DECIMAL"}],"type":"GEOMETRY"},{"operator":"6","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"SEARCH","operand":[{"column":4,"type":"BIGINT"},{"operator":"Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"ST_DWITHIN","operand":[{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"},{"operator":"POINT (10 20)","operand":[],"type":"GEOMETRY"},{"operator":"6","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT($2, $1), ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), 6)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n","LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]), ST_DWITHIN(ST_POINT($2, $1), POINT (10 20):GEOMETRY, 6))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSpatialDWithinToHilbert.json b/tests/benchmark/testSpatialDWithinToHilbert.json new file mode 100644 index 0000000..594e401 --- /dev/null +++ b/tests/benchmark/testSpatialDWithinToHilbert.json @@ -0,0 +1 @@ +{"schemas":[{"name":"RESTAURANTS","fields":["NAME","LATITUDE","LONGITUDE","CUISINE","HILBERT"],"types":["VARCHAR","INTEGER","INTEGER","VARCHAR","BIGINT"],"nullable":[false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"ST_DWITHIN","operand":[{"operator":"ST_POINT","operand":[{"operator":"10.0","operand":[],"type":"DECIMAL"},{"operator":"20.0","operand":[],"type":"DECIMAL"}],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"SEARCH","operand":[{"column":4,"type":"BIGINT"},{"operator":"Sarg[[28988..28989], [28991..28994], [29006..29009], [29011..29014], [32426..32429], [32431..32434], [32446..32449], [32451..32454], [32506..32509], [32511..32514], [32526..32527], [32929..32930], [32942..32949], [32951..32953], [32955..32970], [32973..32975], [33009..33011], [33014..33185], [33187..33190], [33205..33207], [33209..33211], [33226..33229], [33231..33265], [33267..33270], [36392..36401], [36403..36404], [36421..36423], [36425..36427], [36442..36445], [36447..36548], [36556..36568]]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"ST_DWITHIN","operand":[{"operator":"POINT (10 20)","operand":[],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), ST_POINT($2, $1), 10)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n","LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[28988..28989], [28991..28994], [29006..29009], [29011..29014], [32426..32429], [32431..32434], [32446..32449], [32451..32454], [32506..32509], [32511..32514], [32526..32527], [32929..32930], [32942..32949], [32951..32953], [32955..32970], [32973..32975], [33009..33011], [33014..33185], [33187..33190], [33205..33207], [33209..33211], [33226..33229], [33231..33265], [33267..33270], [36392..36401], [36403..36404], [36421..36423], [36425..36427], [36442..36445], [36447..36548], [36556..36568]]), ST_DWITHIN(POINT (10 20):GEOMETRY, ST_POINT($2, $1), 10))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSpatialDWithinToHilbertNegative.json b/tests/benchmark/testSpatialDWithinToHilbertNegative.json new file mode 100644 index 0000000..db148ec --- /dev/null +++ b/tests/benchmark/testSpatialDWithinToHilbertNegative.json @@ -0,0 +1 @@ +{"schemas":[{"name":"RESTAURANTS","fields":["NAME","LATITUDE","LONGITUDE","CUISINE","HILBERT"],"types":["VARCHAR","INTEGER","INTEGER","VARCHAR","BIGINT"],"nullable":[false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"ST_DWITHIN","operand":[{"operator":"ST_POINT","operand":[{"operator":"10.0","operand":[],"type":"DECIMAL"},{"operator":"20.0","operand":[],"type":"DECIMAL"}],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"},{"operator":"-2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"values":{"schema":["VARCHAR","INTEGER","INTEGER","VARCHAR","BIGINT"],"content":[]}}}}],"help":["LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), ST_POINT($2, $1), -2)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n","LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSpatialDWithinToHilbertZero.json b/tests/benchmark/testSpatialDWithinToHilbertZero.json new file mode 100644 index 0000000..b53c925 --- /dev/null +++ b/tests/benchmark/testSpatialDWithinToHilbertZero.json @@ -0,0 +1 @@ +{"schemas":[{"name":"RESTAURANTS","fields":["NAME","LATITUDE","LONGITUDE","CUISINE","HILBERT"],"types":["VARCHAR","INTEGER","INTEGER","VARCHAR","BIGINT"],"nullable":[false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"ST_DWITHIN","operand":[{"operator":"ST_POINT","operand":[{"operator":"10.0","operand":[],"type":"DECIMAL"},{"operator":"20.0","operand":[],"type":"DECIMAL"}],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"33139","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"operator":"POINT (10 20)","operand":[],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), ST_POINT($2, $1), 0)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n","LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(=($4, 33139), =(POINT (10 20), ST_POINT($2, $1)))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSpatialReduce.json b/tests/benchmark/testSpatialReduce.json new file mode 100644 index 0000000..76aedcb --- /dev/null +++ b/tests/benchmark/testSpatialReduce.json @@ -0,0 +1 @@ +{"schemas":[{"name":"RESTAURANTS","fields":["NAME","LATITUDE","LONGITUDE","CUISINE","HILBERT"],"types":["VARCHAR","INTEGER","INTEGER","VARCHAR","BIGINT"],"nullable":[false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"ST_BUFFER","operand":[{"operator":"ST_POINT","operand":[{"operator":"0.0","operand":[],"type":"DECIMAL"},{"operator":"0.0","operand":[],"type":"DECIMAL"}],"type":"GEOMETRY"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"GEOMETRY"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"CAST","operand":[{"operator":"POLYGON ((1 0, 0.9238795325112867 -0.3826834323650898, 0.7071067811865476 -0.7071067811865475, 0.3826834323650898 -0.9238795325112867, 0.0000000000000001 -1, -0.3826834323650897 -0.9238795325112867, -0.7071067811865475 -0.7071067811865476, -0.9238795325112867 -0.3826834323650899, -1 -0.0000000000000001, -0.9238795325112868 0.3826834323650897, -0.7071067811865477 0.7071067811865475, -0.3826834323650903 0.9238795325112865, -0.0000000000000002 1, 0.38268343236509 0.9238795325112866, 0.7071067811865474 0.7071067811865477, 0.9238795325112865 0.3826834323650904, 1 0))","operand":[],"type":"GEOMETRY"}],"type":"GEOMETRY"}],"source":{"scan":0}}}],"help":["LogicalProject(B=[ST_BUFFER(ST_POINT(0.0:DECIMAL(2, 1), 0.0:DECIMAL(2, 1)), 1, 4)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n","LogicalProject(B=[CAST(POLYGON ((1 0, 0.9238795325112867 -0.3826834323650898, 0.7071067811865476 -0.7071067811865475, 0.3826834323650898 -0.9238795325112867, 0.0000000000000001 -1, -0.3826834323650897 -0.9238795325112867, -0.7071067811865475 -0.7071067811865476, -0.9238795325112867 -0.3826834323650899, -1 -0.0000000000000001, -0.9238795325112868 0.3826834323650897, -0.7071067811865477 0.7071067811865475, -0.3826834323650903 0.9238795325112865, -0.0000000000000002 1, 0.38268343236509 0.9238795325112866, 0.7071067811865474 0.7071067811865477, 0.9238795325112865 0.3826834323650904, 1 0)):GEOMETRY):GEOMETRY])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testStrengthenJoinType.json b/tests/benchmark/testStrengthenJoinType.json new file mode 100644 index 0000000..e6c256d --- /dev/null +++ b/tests/benchmark/testStrengthenJoinType.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":6,"type":"TIMESTAMP"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":10,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NOT NULL","operand":[{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":6,"type":"TIMESTAMP"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":10,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"operator":"CAST","operand":[{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"column":3,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"CAST","operand":[{"column":4,"type":"VARCHAR"}],"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"operator":"CAST","operand":[{"column":6,"type":"TIMESTAMP"}],"type":"TIMESTAMP"},{"operator":"CAST","operand":[{"column":7,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"column":8,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"column":9,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"column":10,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"filter":{"condition":{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}}],"help":["LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalFilter(condition=[AND(IS NOT NULL($9), >($7, 100))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[CAST($2):INTEGER], ENAME=[CAST($3):VARCHAR(20)], JOB=[CAST($4):VARCHAR(10)], MGR=[$5], HIREDATE=[CAST($6):TIMESTAMP(0)], SAL=[CAST($7):INTEGER], COMM=[CAST($8):INTEGER], DEPTNO0=[CAST($9):INTEGER], SLACKER=[CAST($10):BOOLEAN])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSumAndDistinctSumWithExpandSumType.json b/tests/benchmark/testSumAndDistinctSumWithExpandSumType.json new file mode 100644 index 0000000..216de04 --- /dev/null +++ b/tests/benchmark/testSumAndDistinctSumWithExpandSumType.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["COMM"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"project":{"target":[{"operator":"CAST","operand":[{"column":0,"type":"DECIMAL"}],"type":"BIGINT"},{"column":1,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"DECIMAL"},{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[SUM(DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[CAST($0):BIGINT], EXPR$1=[$1])\n LogicalAggregate(group=[{}], EXPR$0=[SUM($1)], EXPR$1=[SUM($0)])\n LogicalAggregate(group=[{0}], EXPR$0=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSwapOuterJoin.json b/tests/benchmark/testSwapOuterJoin.json new file mode 100644 index 0000000..39652a9 --- /dev/null +++ b/tests/benchmark/testSwapOuterJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":1},"right":{"scan":0}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceAggregate.json b/tests/benchmark/testTransitiveInferenceAggregate.json new file mode 100644 index 0000000..988d833 --- /dev/null +++ b/tests/benchmark/testTransitiveInferenceAggregate.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},"right":{"scan":0}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{0}])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{0}])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceComplexPredicate.json b/tests/benchmark/testTransitiveInferenceComplexPredicate.json new file mode 100644 index 0000000..84b2548 --- /dev/null +++ b/tests/benchmark/testTransitiveInferenceComplexPredicate.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["SAL","COMM","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"AND","operand":[{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"/","operand":[{"column":0,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},"right":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"AND","operand":[{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"/","operand":[{"column":0,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($1, $3)], joinType=[inner])\n LogicalFilter(condition=[AND(>($1, 7), =($0, $1), >(+($0, $1), /($0, 2)))])\n LogicalProject(COMM=[$1], DEPTNO=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($0, $1)])\n LogicalProject(SAL=[$0], DEPTNO=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($1, $3)], joinType=[inner])\n LogicalFilter(condition=[AND(>($1, 7), =($0, $1), >(+($0, $1), /($0, 2)))])\n LogicalProject(COMM=[$1], DEPTNO=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($1, 7)])\n LogicalFilter(condition=[=($0, $1)])\n LogicalProject(SAL=[$0], DEPTNO=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceConjunctInPullUp.json b/tests/benchmark/testTransitiveInferenceConjunctInPullUp.json new file mode 100644 index 0000000..64e7e22 --- /dev/null +++ b/tests/benchmark/testTransitiveInferenceConjunctInPullUp.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":0,"type":"INTEGER"},{"operator":"Sarg[7, 9, (10..+∞)]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":0}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":0,"type":"INTEGER"},{"operator":"Sarg[7, 9, (10..+∞)]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":0,"type":"INTEGER"},{"operator":"Sarg[7, 9, (10..+∞)]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[SEARCH($0, Sarg[7, 9, (10..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[SEARCH($0, Sarg[7, 9, (10..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[SEARCH($0, Sarg[7, 9, (10..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceJoin.json b/tests/benchmark/testTransitiveInferenceJoin.json new file mode 100644 index 0000000..45850d2 --- /dev/null +++ b/tests/benchmark/testTransitiveInferenceJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceJoin3way.json b/tests/benchmark/testTransitiveInferenceJoin3way.json new file mode 100644 index 0000000..e17c6ce --- /dev/null +++ b/tests/benchmark/testTransitiveInferenceJoin3way.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":0}}},"right":{"scan":0}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceJoin3wayAgg.json b/tests/benchmark/testTransitiveInferenceJoin3wayAgg.json new file mode 100644 index 0000000..c4022f0 --- /dev/null +++ b/tests/benchmark/testTransitiveInferenceJoin3wayAgg.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},"right":{"scan":0}}},"right":{"scan":0}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{0}])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{0}])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceLeftOuterJoin.json b/tests/benchmark/testTransitiveInferenceLeftOuterJoin.json new file mode 100644 index 0000000..daa1b84 --- /dev/null +++ b/tests/benchmark/testTransitiveInferenceLeftOuterJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"9","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":0}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"9","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($1, 9)])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($1, 9)])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceProject.json b/tests/benchmark/testTransitiveInferenceProject.json new file mode 100644 index 0000000..45d5905 --- /dev/null +++ b/tests/benchmark/testTransitiveInferenceProject.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":0}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferencePullUpThruAlias.json b/tests/benchmark/testTransitiveInferencePullUpThruAlias.json new file mode 100644 index 0000000..e510e2b --- /dev/null +++ b/tests/benchmark/testTransitiveInferencePullUpThruAlias.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["COMM","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[>($0, 7)])\n LogicalProject(COMM=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[>($0, 7)])\n LogicalProject(COMM=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceRightOuterJoin.json b/tests/benchmark/testTransitiveInferenceRightOuterJoin.json new file mode 100644 index 0000000..085c33b --- /dev/null +++ b/tests/benchmark/testTransitiveInferenceRightOuterJoin.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"9","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"9","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"9","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($0, 7)])\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 9)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($0, 7)])\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\n LogicalFilter(condition=[>($0, 9)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 9)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceUnion.json b/tests/benchmark/testTransitiveInferenceUnion.json new file mode 100644 index 0000000..ad53bba --- /dev/null +++ b/tests/benchmark/testTransitiveInferenceUnion.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"union":[{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}]},"right":{"scan":0}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"union":[{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}]},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceUnion3way.json b/tests/benchmark/testTransitiveInferenceUnion3way.json new file mode 100644 index 0000000..f3b7b76 --- /dev/null +++ b/tests/benchmark/testTransitiveInferenceUnion3way.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"union":[{"union":[{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}]},{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}]},"right":{"scan":0}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"union":[{"union":[{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}]},{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}]},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalUnion(all=[true])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalUnion(all=[true])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceUnionAlwaysTrue.json b/tests/benchmark/testTransitiveInferenceUnionAlwaysTrue.json new file mode 100644 index 0000000..67260ef --- /dev/null +++ b/tests/benchmark/testTransitiveInferenceUnionAlwaysTrue.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"union":[{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"scan":0}]}}},{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"union":[{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"scan":0}]}}}}}],"help":["LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[<($0, 4)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalUnion(all=[true])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[<($0, 4)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[<($0, 4)])\n LogicalUnion(all=[true])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json b/tests/benchmark/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json new file mode 100644 index 0000000..7e0c61c --- /dev/null +++ b/tests/benchmark/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":9,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"<","operand":[{"operator":"+","operand":[{"column":9,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">=","operand":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"30","operand":[],"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":9,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"<","operand":[{"operator":"+","operand":[{"column":9,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">=","operand":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"30","operand":[],"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":9,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"<","operand":[{"operator":"+","operand":[{"column":9,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">=","operand":[{"column":7,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"30","operand":[],"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":9,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"<","operand":[{"operator":"+","operand":[{"column":9,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">=","operand":[{"column":7,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"30","operand":[],"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[AND(<(+($0, 50), 20), >=($cor0.DEPTNO, +(30, $1)))])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[AND(<(+($0, 50), 20), >=($cor0.DEPTNO, $1))])\n LogicalProject(EMPNO=[$0], $f9=[+(30, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testUnionMergeRule.json b/tests/benchmark/testUnionMergeRule.json new file mode 100644 index 0000000..474b604 --- /dev/null +++ b/tests/benchmark/testUnionMergeRule.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"union":[{"union":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"union":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}]}]},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}]},{"union":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}]}],"help":["LogicalUnion(all=[true])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalUnion(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testUnionToDistinctRule.json b/tests/benchmark/testUnionToDistinctRule.json new file mode 100644 index 0000000..3e1e4c1 --- /dev/null +++ b/tests/benchmark/testUnionToDistinctRule.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"union":[{"scan":0},{"scan":0}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"scan":0},{"scan":0}]}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"scan":0},{"scan":0}]}}}}}]}}],"help":["LogicalUnion(all=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWhereAnyCorrelatedInSelect.json b/tests/benchmark/testWhereAnyCorrelatedInSelect.json new file mode 100644 index 0000000..e9eecbe --- /dev/null +++ b/tests/benchmark/testWhereAnyCorrelatedInSelect.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"> SOME","operand":[{"column":0,"type":"INTEGER"}],"query":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":10,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":1}}}}},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":13,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":"OR","operand":[{"operator":"IS NULL","operand":[{"column":12,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":10,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":"OR","operand":[{"operator":"IS NULL","operand":[{"column":12,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":10,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":">","operand":[{"column":10,"type":"BIGINT"},{"column":11,"type":"BIGINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"BIGINT"},{"column":2,"type":"BIGINT"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"column":0,"type":"VARCHAR"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[> SOME($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[AND(=($2, $13), OR(AND(>($0, $9), IS NOT TRUE(OR(IS NULL($12), =($10, 0)))), AND(>($0, $9), IS NOT TRUE(OR(IS NULL($12), =($10, 0))), IS NOT TRUE(>($0, $9)), IS NOT TRUE(>($10, $11)))))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(m=[$1], c=[$2], d=[$2], trueLiteral=[true], NAME=[$0])\n LogicalAggregate(group=[{0}], m=[MIN($1)], c=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWhereExpressionInCorrelated.json b/tests/benchmark/testWhereExpressionInCorrelated.json new file mode 100644 index 0000000..fa53242 --- /dev/null +++ b/tests/benchmark/testWhereExpressionInCorrelated.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"IN","operand":[{"column":1,"type":"INTEGER"}],"query":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"+","operand":[{"column":8,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}],"help":["LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[IN($1, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[=(+($5, 1), $cor0.SALPLUS)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalProject(ENAME=[$1], DEPTNO=[$7], SALPLUS=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(ENAME=[$0])\n LogicalJoin(condition=[AND(=($2, $4), =($1, $3))], joinType=[inner])\n LogicalProject(ENAME=[$1], DEPTNO=[$7], SALPLUS=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], $f9=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWhereExpressionInCorrelated2.json b/tests/benchmark/testWhereExpressionInCorrelated2.json new file mode 100644 index 0000000..5d97d71 --- /dev/null +++ b/tests/benchmark/testWhereExpressionInCorrelated2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"IN","operand":[{"column":1,"type":"INTEGER"}],"query":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"+","operand":[{"column":8,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}},"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"},{"operator":"-","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"},{"operator":"-","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}}],"help":["LogicalProject(NAME=[$0])\n LogicalFilter(condition=[IN($1, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[=(+($5, 1), $cor0.DEPTNOMINUS)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalProject(NAME=[$1], DEPTNO=[$0], DEPTNOMINUS=[-($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0])\n LogicalJoin(condition=[AND(=($2, $4), =($1, $3))], joinType=[inner])\n LogicalProject(NAME=[$1], DEPTNO=[$0], DEPTNOMINUS=[-($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], $f9=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWhereInCorrelated.json b/tests/benchmark/testWhereInCorrelated.json new file mode 100644 index 0000000..c71ffac --- /dev/null +++ b/tests/benchmark/testWhereInCorrelated.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","JOB","SAL"],"types":["INTEGER","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IN","operand":[{"column":0,"type":"INTEGER"}],"query":{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":1}}}}},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}],"help":["LogicalProject(SAL=[$2])\n LogicalFilter(condition=[IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(SAL=[$2])\n LogicalJoin(condition=[AND(=($1, $4), =($0, $3))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWhereInJoinCorrelated.json b/tests/benchmark/testWhereInJoinCorrelated.json new file mode 100644 index 0000000..2dfb9e9 --- /dev/null +++ b/tests/benchmark/testWhereInJoinCorrelated.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IN","operand":[{"column":1,"type":"INTEGER"}],"query":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":11,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"column":11,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"correlate":[{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},{"distinct":{"correlate":[{"project":{"target":[{"column":11,"type":"INTEGER"}],"source":{"project":{"target":[{"column":11,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":12,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":16,"type":"INTEGER"},{"column":18,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":11,"type":"INTEGER"},{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":12,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":13,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":17,"type":"INTEGER"},{"column":19,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IN($1, {\nLogicalProject(SAL=[$5])\n LogicalFilter(condition=[>($7, $cor0.DEPTNO)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalJoin(condition=[=($2, $3)], joinType=[inner])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=($5, $11)])\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{7}])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(SAL=[$0])\n LogicalFilter(condition=[>($1, $cor0.DEPTNO)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWhereNotInCorrelated.json b/tests/benchmark/testWhereNotInCorrelated.json new file mode 100644 index 0000000..022eddf --- /dev/null +++ b/tests/benchmark/testWhereNotInCorrelated.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","JOB","SAL"],"types":["INTEGER","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"NOT","operand":[{"operator":"IN","operand":[{"column":0,"type":"INTEGER"}],"query":{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":1}}}}},"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":"OR","operand":[{"operator":"IS NOT NULL","operand":[{"column":7,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":4,"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":8,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":1,"type":"BIGINT"},{"column":0,"type":"VARCHAR"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"scan":1}}}}}}}]}}}}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"column":1,"type":"VARCHAR"}],"source":{"scan":1}}}}}}}}}],"help":["LogicalProject(SAL=[$2])\n LogicalFilter(condition=[NOT(IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(SAL=[$2])\n LogicalFilter(condition=[OR(=($3, 0), IS NOT TRUE(OR(IS NOT NULL($7), <($4, $3))))])\n LogicalJoin(condition=[AND(=($0, $6), =($1, $8))], joinType=[left])\n LogicalJoin(condition=[=($1, $5)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(c=[$1], ck=[$1], NAME=[$0])\n LogicalAggregate(group=[{0}], c=[COUNT()])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], i=[true], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWhereNotInCorrelated2.json b/tests/benchmark/testWhereNotInCorrelated2.json new file mode 100644 index 0000000..3340594 --- /dev/null +++ b/tests/benchmark/testWhereNotInCorrelated2.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"NOT","operand":[{"operator":"IN","operand":[{"column":0,"type":"INTEGER"}],"query":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":">","operand":[{"column":11,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":9,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"VARCHAR"},{"column":9,"type":"INTEGER"},{"column":14,"type":"INTEGER"}],"source":{"scan":0}}}}}}},"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":"OR","operand":[{"operator":"IS NOT NULL","operand":[{"column":13,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":10,"type":"BIGINT"},{"column":9,"type":"BIGINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":14,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":1,"type":"BIGINT"},{"column":0,"type":"VARCHAR"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[NOT(IN($0, {\nLogicalProject(EMPNO=[$1])\n LogicalFilter(condition=[AND(>($2, 2), =($cor0.ENAME, $0))])\n LogicalProject(ENAME=[$1], EMPNO=[$0], R=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(=($9, 0), IS NOT TRUE(OR(IS NOT NULL($13), <($10, $9))))])\n LogicalJoin(condition=[AND(=($0, $12), =($1, $14))], joinType=[left])\n LogicalJoin(condition=[=($1, $11)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(c=[$1], ck=[$1], ENAME=[$0])\n LogicalAggregate(group=[{0}], c=[COUNT()])\n LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[>($1, 2)])\n LogicalProject(ENAME=[$1], R=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$1], i=[true], ENAME=[$0])\n LogicalFilter(condition=[>($2, 2)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], R=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWhereOrSubQuery.json b/tests/benchmark/testWhereOrSubQuery.json new file mode 100644 index 0000000..84ef45c --- /dev/null +++ b/tests/benchmark/testWhereOrSubQuery.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NOT","operand":[{"operator":"IN","operand":[{"column":0,"type":"INTEGER"}],"query":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"scan":1}}},"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":10,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"scan":1}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(=($5, 4), NOT(IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(=($5, 4), IS NULL($10))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], i=[true])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWithinDistinct.json b/tests/benchmark/testWithinDistinct.json new file mode 100644 index 0000000..e569a1c --- /dev/null +++ b/tests/benchmark/testWithinDistinct.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","SAL","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CAST","operand":[{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"operator":"=","operand":[{"column":6,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[SUM($1) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$2], SAL=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], $f1=[CAST($1):INTEGER NOT NULL], $f2=[$2])\n LogicalAggregate(group=[{0}], agg#0=[MIN($1) FILTER $3], agg#1=[$SUM0($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f3=[$3], $f6=[=($5, 1)], $f7=[AND(=($5, 0), $THROW_UNLESS(OR(<>($5, 0), =($3, $4)), 'more than one distinct value in agg UNIQUE_VALUE'))])\n LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}]], agg#0=[$SUM0($1)], agg#1=[MIN($1)], agg#2=[MAX($1)], agg#3=[GROUPING($0, $2)])\n LogicalProject(DEPTNO=[$2], SAL=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWithinDistinctCountDistinct.json b/tests/benchmark/testWithinDistinctCountDistinct.json new file mode 100644 index 0000000..e16b234 --- /dev/null +++ b/tests/benchmark/testWithinDistinctCountDistinct.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":4,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":4,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":4,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BIGINT"},{"column":2,"type":"BIGINT"},{"column":2,"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"operator":"=","operand":[{"column":6,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":6,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":6,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":6,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"VARCHAR"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":5,"type":"VARCHAR"},{"operator":">","operand":[{"column":8,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":5,"type":"VARCHAR"},{"operator":"=","operand":[{"column":7,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":7,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"VARCHAR"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"GROUPING","operand":[{"column":4,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":7,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":10,"type":"INTEGER"},{"column":6,"type":"VARCHAR"},{"operator":">","operand":[{"column":9,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], SS_C=[SUM($1) WITHIN DISTINCT ($2)], CDJ=[COUNT(DISTINCT $3)], CJ_J=[COUNT() WITHIN DISTINCT ($3)], CDJ_J=[COUNT(DISTINCT $3) WITHIN DISTINCT ($3)], CDJ_FILTERED=[COUNT(DISTINCT $3) FILTER $4])\n LogicalProject(DEPTNO=[$7], SAL=[$5], COMM=[$6], JOB=[$2], $f4=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], $f1=[$1], $f2=[$2], $f20=[$2], $f21=[$2], $f3=[$3])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[COUNT($2) FILTER $5])\n LogicalProject(DEPTNO=[$0], $f3=[$3], $f4=[$4], $f7=[=($6, 1)], $f8=[=($6, 2)], $f9=[AND(=($6, 2), >($5, 0))])\n LogicalAggregate(group=[{0, 2, 3}], groups=[[{0, 2}, {0, 3}]], agg#0=[MIN($1)], agg#1=[MIN($3) FILTER $4], agg#2=[COUNT() FILTER $4], agg#3=[GROUPING($0, $2, $3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], COMM=[$6], JOB=[$2], $f4=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWithinDistinctFilteredAggs.json b/tests/benchmark/testWithinDistinctFilteredAggs.json new file mode 100644 index 0000000..56b4e27 --- /dev/null +++ b/tests/benchmark/testWithinDistinctFilteredAggs.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":3,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"column":4,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":9,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":8,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":9,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":8,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":6,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"operator":">","operand":[{"column":9,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"VARCHAR"},{"column":9,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":4,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":10,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":10,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":10,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":10,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":9,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":10,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":8,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":10,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":9,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":3,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":8,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":8,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"GROUPING","operand":[{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":7,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":7,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"operator":">","operand":[{"column":10,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":6,"type":"VARCHAR"},{"column":10,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":5,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($1) FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/(CASE(=($4, 0), null:INTEGER, $3), $4)):INTEGER])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[$SUM0($2) FILTER $5], agg#3=[COUNT() FILTER $6])\n LogicalProject(DEPTNO=[$0], $f3=[$3], $f6=[$6], $f10=[AND(=($9, 2), >($5, 0), $THROW_UNLESS(OR(<>($9, 2), AND(IS NULL($3), IS NULL($4)), IS TRUE(=($3, $4))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f11=[AND(=($9, 2), >($5, 0))], $f12=[AND(=($9, 1), >($8, 0), $THROW_UNLESS(OR(<>($9, 1), AND(IS NULL($6), IS NULL($7)), IS TRUE(=($6, $7))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f13=[AND(=($9, 1), >($8, 0))])\n LogicalAggregate(group=[{0, 1, 3}], groups=[[{0, 1}, {0, 3}]], agg#0=[MIN($1) FILTER $2], agg#1=[MAX($1) FILTER $2], agg#2=[COUNT() FILTER $2], agg#3=[MIN($4) FILTER $5], agg#4=[MAX($4) FILTER $5], agg#5=[COUNT() FILTER $5], agg#6=[GROUPING($0, $1, $3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWithinDistinctFilteredAggsSameFilter.json b/tests/benchmark/testWithinDistinctFilteredAggsSameFilter.json new file mode 100644 index 0000000..07d7cd7 --- /dev/null +++ b/tests/benchmark/testWithinDistinctFilteredAggsSameFilter.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"column":3,"type":"VARCHAR"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"column":4,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":8,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":8,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":8,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":8,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":8,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":8,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":6,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":4,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"column":5,"type":"VARCHAR"},{"column":9,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":9,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":9,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":8,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"column":3,"type":"VARCHAR"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":8,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":8,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":7,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":7,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":5,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"column":6,"type":"VARCHAR"},{"column":10,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($1) FILTER $2])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[LIKE($1, '%ok%')], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/(CASE(=($4, 0), null:INTEGER, $3), $4)):INTEGER])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[$SUM0($2) FILTER $5], agg#3=[COUNT() FILTER $6])\n LogicalProject(DEPTNO=[$0], $f3=[$3], $f6=[$6], $f9=[AND(=($8, 2), >($5, 0), $THROW_UNLESS(OR(<>($8, 2), AND(IS NULL($3), IS NULL($4)), IS TRUE(=($3, $4))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f10=[AND(=($8, 2), >($5, 0))], $f11=[AND(=($8, 1), >($5, 0), $THROW_UNLESS(OR(<>($8, 1), AND(IS NULL($6), IS NULL($7)), IS TRUE(=($6, $7))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f12=[AND(=($8, 1), >($5, 0))])\n LogicalAggregate(group=[{0, 1, 3}], groups=[[{0, 1}, {0, 3}]], agg#0=[MIN($1) FILTER $2], agg#1=[MAX($1) FILTER $2], agg#2=[COUNT() FILTER $2], agg#3=[MIN($4) FILTER $2], agg#4=[MAX($4) FILTER $2], agg#5=[GROUPING($0, $1, $3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[LIKE($1, '%ok%')], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWithinDistinctFilteredAggsUniformDistinctKeys.json b/tests/benchmark/testWithinDistinctFilteredAggsUniformDistinctKeys.json new file mode 100644 index 0000000..0fddbe3 --- /dev/null +++ b/tests/benchmark/testWithinDistinctFilteredAggsUniformDistinctKeys.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":3,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"column":4,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":7,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":7,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"operator":">","operand":[{"column":8,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":4,"type":"VARCHAR"},{"column":8,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":8,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":8,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":3,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"operator":">","operand":[{"column":9,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"VARCHAR"},{"column":9,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":4,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($3) FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/(CASE(=($4, 0), null:INTEGER, $3), $4)):INTEGER])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[$SUM0($2) FILTER $5], agg#3=[COUNT() FILTER $6])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f5=[$5], $f8=[AND(>($4, 0), $THROW_UNLESS(OR(AND(IS NULL($2), IS NULL($3)), IS TRUE(=($2, $3))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f9=[>($4, 0)], $f10=[AND(>($7, 0), $THROW_UNLESS(OR(AND(IS NULL($5), IS NULL($6)), IS TRUE(=($5, $6))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f11=[>($7, 0)])\n LogicalAggregate(group=[{0, 3}], agg#0=[MIN($1) FILTER $2], agg#1=[MAX($1) FILTER $2], agg#2=[COUNT() FILTER $2], agg#3=[MIN($4) FILTER $5], agg#4=[MAX($4) FILTER $5], agg#5=[COUNT() FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json b/tests/benchmark/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json new file mode 100644 index 0000000..0dc11ce --- /dev/null +++ b/tests/benchmark/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":3,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"column":4,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"operator":">","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"operator":">","operand":[{"column":8,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":4,"type":"VARCHAR"},{"column":8,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":3,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"operator":">","operand":[{"column":9,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"VARCHAR"},{"column":9,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":4,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($3) FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/(CASE(=($4, 0), null:INTEGER, $3), $4)):INTEGER])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $3], agg#2=[$SUM0($2) FILTER $4], agg#3=[COUNT() FILTER $4])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f4=[$4], $f6=[>($3, 0)], $f7=[>($5, 0)])\n LogicalAggregate(group=[{0, 3}], agg#0=[MIN($1) FILTER $2], agg#1=[COUNT() FILTER $2], agg#2=[MIN($4) FILTER $5], agg#3=[COUNT() FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWithinDistinctNoThrow.json b/tests/benchmark/testWithinDistinctNoThrow.json new file mode 100644 index 0000000..9bf3389 --- /dev/null +++ b/tests/benchmark/testWithinDistinctNoThrow.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","SAL","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CAST","operand":[{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[SUM($1) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$2], SAL=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], $f1=[CAST($1):INTEGER NOT NULL], $f2=[$2])\n LogicalAggregate(group=[{0}], agg#0=[MIN($1) FILTER $3], agg#1=[$SUM0($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f3=[$3], $f5=[=($4, 1)], $f6=[=($4, 0)])\n LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}]], agg#0=[$SUM0($1)], agg#1=[MIN($1)], agg#2=[GROUPING($0, $2)])\n LogicalProject(DEPTNO=[$2], SAL=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWithinDistinctUniformDistinctKeys.json b/tests/benchmark/testWithinDistinctUniformDistinctKeys.json new file mode 100644 index 0000000..fed9543 --- /dev/null +++ b/tests/benchmark/testWithinDistinctUniformDistinctKeys.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","SAL","COMM","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"operator":"$THROW_UNLESS","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":"$THROW_UNLESS","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($2)], EXPR$2=[AVG($3) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$3], SAL=[$1], JOB=[$0], COMM=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[$SUM0($2) FILTER $4], agg#2=[COUNT()])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f4=[$4], $f6=[$THROW_UNLESS(=($2, $3), 'more than one distinct value in agg UNIQUE_VALUE')], $f7=[$THROW_UNLESS(=($4, $5), 'more than one distinct value in agg UNIQUE_VALUE')])\n LogicalAggregate(group=[{0, 2}], agg#0=[MIN($1)], agg#1=[MAX($1)], agg#2=[MIN($3)], agg#3=[MAX($3)])\n LogicalProject(DEPTNO=[$3], SAL=[$1], JOB=[$0], COMM=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWithinDistinctUniformDistinctKeysNoThrow.json b/tests/benchmark/testWithinDistinctUniformDistinctKeysNoThrow.json new file mode 100644 index 0000000..85a27ec --- /dev/null +++ b/tests/benchmark/testWithinDistinctUniformDistinctKeysNoThrow.json @@ -0,0 +1 @@ +{"schemas":[{"name":"EMP","fields":["JOB","SAL","COMM","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($2)], EXPR$2=[AVG($3) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$3], SAL=[$1], JOB=[$0], COMM=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($2)], agg#1=[$SUM0($3)], agg#2=[COUNT()])\n LogicalAggregate(group=[{0, 2}], agg#0=[MIN($1)], agg#1=[MIN($3)])\n LogicalProject(DEPTNO=[$3], SAL=[$1], JOB=[$0], COMM=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file From 7bd67b92271b89af844eab8df4b1ba4637a773d5 Mon Sep 17 00:00:00 2001 From: Shuxian Wang Date: Mon, 8 May 2023 14:49:05 -0700 Subject: [PATCH 03/11] Code cleanup. --- flake.nix | 2 +- src/main.rs | 9 ++--- src/pipeline.rs | 77 +++++++++++++++++++++++++++------------- src/pipeline/normal.rs | 2 +- src/pipeline/null.rs | 12 +++---- src/pipeline/relation.rs | 29 +++------------ src/pipeline/shared.rs | 4 +-- src/pipeline/stable.rs | 5 ++- src/solver.rs | 15 -------- 9 files changed, 73 insertions(+), 82 deletions(-) delete mode 100644 src/solver.rs diff --git a/flake.nix b/flake.nix index 4ffdf41..1d71181 100644 --- a/flake.nix +++ b/flake.nix @@ -37,7 +37,7 @@ devShells.default = pkgs.mkShell { inputsFrom = [ cosette-prover ]; - packages = with pkgs; [ rust-analyzer ]; + packages = with pkgs; [ rust-analyzer julia-bin ] ++ lib.optionals stdenv.isLinux [ linuxPackages.perf ]; }; }); diff --git a/src/main.rs b/src/main.rs index 2254534..4a661fc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,11 +12,9 @@ use env_logger::{Builder, Env, Target}; use itertools::Itertools; use walkdir::WalkDir; -use crate::pipeline::relation::Input; -use crate::solver::Payload; +use crate::pipeline::{unify, Input}; mod pipeline; -mod solver; fn visit>(dir: P, mut cb: impl FnMut(usize, &Path)) -> io::Result<()> { WalkDir::new(dir) @@ -47,7 +45,7 @@ fn main() -> io::Result<()> { for arg in std::env::args() { visit(arg, |i, path| { use CosetteResult::*; - let file = File::open(&path).unwrap(); + let file = File::open(path).unwrap(); let mut buf_reader = BufReader::new(file); let mut contents = String::new(); println!("#{}: {}", i, path.to_string_lossy().as_ref()); @@ -56,8 +54,7 @@ fn main() -> io::Result<()> { let result = std::panic::catch_unwind(|| match serde_json::from_str::(&contents) { Ok(rel) => { - let payload = Payload::from(rel); - let provable = payload.check(); + let provable = unify(rel); println!( "Equivalence is {}provable for {}", if provable { "" } else { "not " }, diff --git a/src/pipeline.rs b/src/pipeline.rs index 55b8b60..683cbc4 100644 --- a/src/pipeline.rs +++ b/src/pipeline.rs @@ -2,7 +2,8 @@ use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; -use imbl::{vector, Vector}; +use imbl::vector; +use serde::{Deserialize, Serialize}; use z3::{Config, Context, Solver}; use crate::pipeline::normal::Z3Env; @@ -20,34 +21,62 @@ pub mod syntax; mod tests; pub mod unify; -pub fn evaluate(rel: syntax::Relation, schemas: &Vector) -> normal::Relation { - log::info!("Syntax:\n{}", rel); - let prt: partial::Relation = (&partial::Env::default()).eval(rel); - let nom_env = &normal::Env(vector![], schemas.clone()); - let nom = nom_env.eval(prt); - log::info!("Normal:\n{}", nom); - let mut config = Config::new(); - config.set_timeout_msec(2000); - let z3_ctx = &Context::new(&config); - let ctx = Rc::new(Ctx::new(Solver::new(z3_ctx))); - let uexpr_subst = vector![]; - let z3_subst = vector![]; - let h_ops = Rc::new(RefCell::new(HashMap::new())); - let rel_h_ops = Rc::new(RefCell::new(HashMap::new())); - let env = &stable::Env(uexpr_subst, 0, Z3Env(ctx, z3_subst, h_ops, rel_h_ops)); - let stb = env.eval(nom); - let nom = nom_env.eval(stb); - log::info!("Stable:\n{}", nom); - nom +#[derive(Serialize, Deserialize)] +pub struct Input { + schemas: Vec, + queries: (relation::Relation, relation::Relation), + help: (String, String), } -pub fn unify(rel1: normal::Relation, rel2: normal::Relation) -> bool { +pub fn unify(Input { schemas, queries: (rel1, rel2), help }: Input) -> bool { + let subst = vector![]; + let env = relation::Env(&schemas, &subst, 0); + log::info!("Schemas:\n{:?}", schemas); + log::info!("Input:\n{}\n{}", help.0, help.1); + if rel1 == rel2 { + return true; + } + let rel1 = env.eval(rel1); + let rel2 = env.eval(rel2); + if rel1 == rel2 { + return true; + } + log::info!("Syntax left:\n{}", rel1); + log::info!("Syntax right:\n{}", rel2); + let nom_env = &normal::Env(vector![], schemas.clone().into()); + let eval_nom = |rel: syntax::Relation| -> normal::Relation { + let rel = (&partial::Env::default()).eval(rel); + nom_env.eval(rel) + }; + let rel1 = eval_nom(rel1); + let rel2 = eval_nom(rel2); + log::info!("Normal left:\n{}", rel1); + log::info!("Normal right:\n{}", rel2); + if rel1 == rel2 { + return true; + } + let eval_stb = |nom: normal::Relation| -> normal::Relation { + let mut config = Config::new(); + config.set_timeout_msec(2000); + let z3_ctx = &Context::new(&config); + let ctx = Rc::new(Ctx::new(Solver::new(z3_ctx))); + let h_ops = Rc::new(RefCell::new(HashMap::new())); + let rel_h_ops = Rc::new(RefCell::new(HashMap::new())); + let env = &stable::Env(vector![], 0, Z3Env(ctx, vector![], h_ops, rel_h_ops)); + let stb = env.eval(nom); + nom_env.eval(stb) + }; + let rel1 = eval_stb(rel1); + let rel2 = eval_stb(rel2); + log::info!("Stable left:\n{}", rel1); + log::info!("Stable right:\n{}", rel2); + if rel1 == rel2 { + return true; + } let mut config = Config::new(); config.set_timeout_msec(4000); let z3_ctx = Context::new(&config); let ctx = Rc::new(Ctx::new(Solver::new(&z3_ctx))); - let subst1 = vector![]; - let subst2 = vector![]; - let env = UnifyEnv(ctx, subst1, subst2); + let env = UnifyEnv(ctx, vector![], vector![]); env.unify(&rel1, &rel2) } diff --git a/src/pipeline/normal.rs b/src/pipeline/normal.rs index 0e2a850..222c230 100644 --- a/src/pipeline/normal.rs +++ b/src/pipeline/normal.rs @@ -268,7 +268,7 @@ impl Eval for &Env { Either::Right(uexpr) => env.eval(uexpr), }, Lam(scope, clos_env, body) => { - let vars = shared::Expr::vars(context.len(), scope.clone()); + let vars = shared::Expr::vars(context.len(), scope); let body: partial::UExpr = (&clos_env.append(vars)).eval(body); env.eval(body) }, diff --git a/src/pipeline/null.rs b/src/pipeline/null.rs index 66e4ec8..f87f533 100644 --- a/src/pipeline/null.rs +++ b/src/pipeline/null.rs @@ -230,19 +230,19 @@ impl<'c> Ctx<'c> { // NULL, b &self.bool.variants[0].tester.apply(&[e2]).as_bool().unwrap().ite( // NULL, NULL - &e2, + e2, // NULL, Some(b) &self.bool.variants[1].accessors[0].apply(&[e2]).as_bool().unwrap().ite( // NULL, Some(True) &self.bool_none(), // NULL, Some(False) - &e2, + e2, ), ), // Some(a), b &self.bool.variants[1].accessors[0].apply(&[e1]).as_bool().unwrap().ite( // Some(True), b - &e2, + e2, // Some(False), b &self.bool_some(Bool::from_bool(ctx, false)), ), @@ -255,11 +255,11 @@ impl<'c> Ctx<'c> { // NULL, b &self.bool.variants[0].tester.apply(&[e2]).as_bool().unwrap().ite( // NULL, NULL - &e2, + e2, // NULL, Some(b) &self.bool.variants[1].accessors[0].apply(&[e2]).as_bool().unwrap().ite( // NULL, Some(True) - &e2, + e2, // NULL, Some(False) &self.bool_none(), ), @@ -269,7 +269,7 @@ impl<'c> Ctx<'c> { // Some(True), b &self.bool_some(Bool::from_bool(ctx, true)), // Some(False), b - &e2, + e2, ), ) } diff --git a/src/pipeline/relation.rs b/src/pipeline/relation.rs index 71e2d9f..d08343b 100644 --- a/src/pipeline/relation.rs +++ b/src/pipeline/relation.rs @@ -8,28 +8,9 @@ use serde::{Deserialize, Serialize}; use crate::pipeline::shared::{DataType, Eval, Schema, VL}; use crate::pipeline::syntax::{Logic, UExpr}; use crate::pipeline::{shared, syntax}; -use crate::solver::Payload; - -#[derive(Serialize, Deserialize)] -pub struct Input { - schemas: Vec, - queries: (Relation, Relation), - help: (String, String), -} - -impl From for Payload { - fn from(input: Input) -> Self { - let Input { schemas, queries: (r1, r2), help } = input; - let subst = vector![]; - let env = Env(&schemas, &subst, 0); - log::info!("Schemas:\n{:?}", schemas); - log::info!("Input:\n{}\n{}", help.0, help.1); - Payload(schemas.clone(), env.eval(r1), env.eval(r2)) - } -} #[derive(Copy, Clone)] -struct Env<'e>(&'e [Schema], &'e Vector, usize); +pub struct Env<'e>(pub &'e [Schema], pub &'e Vector, pub usize); fn vars(level: usize, types: Vector) -> Vector { types.into_iter().enumerate().map(|(i, ty)| syntax::Expr::Var(VL(level + i), ty)).collect() @@ -301,7 +282,7 @@ impl Eval for Env<'_> { }, // Values ((a1, b1), (a2, b2), (a3, b3)) // λx, y. [x = a1] × [y = b1] + [x = a2] × [y = b2] + [x = a3] × [y = b3] - Values { schema, content } => { + Values { schema: _, content } => { let vars = vars(lvl, scopes.clone()); let env = Env(schemas, subst, lvl + scopes.len()); let rows = content.into_iter().map(|row| { @@ -456,9 +437,9 @@ impl Eval for Env<'_> { fn eval(self, source: Expr) -> syntax::Expr { use shared::Expr::*; match source { - Expr::Col { column, ty } => self.1[column.0].clone(), + Expr::Col { column, ty: _ } => self.1[column.0].clone(), Expr::Op { op, args, ty } => { - let cast = matches!(op.as_str(), "+" | "-" | "*" | "/" if &ty == &DataType::Real) + let cast = matches!(op.as_str(), "+" | "-" | "*" | "/" if ty == DataType::Real) || matches!(op.as_str(), ">" | "<" | ">=" | "<=" | "=" if args.iter().any(|e| e.ty() == DataType::Real)); let args = if cast { args.into_iter().map(Expr::into_real).collect() } else { args }; @@ -489,7 +470,7 @@ impl Eval for Env<'_> { _ => Logic::Bool(self.eval(source)), }, Expr::Col { ty: DataType::Boolean, .. } => Logic::Bool(self.eval(source)), - Expr::HOp { op, args, rel, ty: DataType::Boolean } => match op.as_str() { + Expr::HOp { op, args: _, rel, ty: DataType::Boolean } => match op.as_str() { // "IN" => Logic::squash(UExpr::App(self.eval(*rel), self.eval(args).into())), "EXISTS" => Logic::Exists(self.eval(*rel)), _ => Logic::Bool(self.eval(source)), diff --git a/src/pipeline/shared.rs b/src/pipeline/shared.rs index 46554f6..7104730 100644 --- a/src/pipeline/shared.rs +++ b/src/pipeline/shared.rs @@ -12,7 +12,7 @@ use indenter::indented; use itertools::Itertools; use serde::{Deserialize, Serialize}; use serde_enum_str::{Deserialize_enum_str, Serialize_enum_str}; -use z3::ast::{Ast, Datatype, Dynamic}; +use z3::ast::{Ast, Dynamic}; use z3::{Context, FuncDecl, Sort}; pub trait Eval { @@ -497,7 +497,7 @@ impl<'c> Ctx<'c> { } pub fn var(&self, ty: &DataType, prefix: &str) -> Dynamic<'c> { - Dynamic::fresh_const(self.solver.get_context(), prefix, &self.sort(ty)).into() + Dynamic::fresh_const(self.solver.get_context(), prefix, &self.sort(ty)) } pub fn app( diff --git a/src/pipeline/stable.rs b/src/pipeline/stable.rs index a109c29..fab2748 100644 --- a/src/pipeline/stable.rs +++ b/src/pipeline/stable.rs @@ -113,21 +113,20 @@ fn var_elim<'c>( fn prune<'c>( v: VL, - keys: &HashSet, deps_map: &mut BTreeMap>, var_subst: &mut Vector>>, exprs: &Vec, env: &Env<'c>, ) { if let Some((v, deps)) = deps_map.remove_entry(&v) { - deps.into_iter().for_each(|w| prune(w, keys, deps_map, var_subst, exprs, env)); + deps.into_iter().for_each(|w| prune(w, deps_map, var_subst, exprs, env)); let i = v.0 - env.0.len(); var_subst[i] = Some((&env.append(var_subst.clone())).eval(exprs[i].clone())); }; } while let Some((&v, _)) = deps_map.first_key_value() { - prune(v, &keys, &mut deps_map, &mut var_subst, &exprs, env); + prune(v, &mut deps_map, &mut var_subst, &exprs, env); } (scope, var_subst) } diff --git a/src/solver.rs b/src/solver.rs deleted file mode 100644 index 88ddb93..0000000 --- a/src/solver.rs +++ /dev/null @@ -1,15 +0,0 @@ -use crate::pipeline::shared::Schema; -use crate::pipeline::syntax::Relation; -use crate::pipeline::{evaluate, unify}; - -/// The collection of all data in a request. -/// We need to check the equivalence of the two relations under the given environment. -#[derive(Clone, Debug)] -pub struct Payload(pub Vec, pub Relation, pub Relation); - -impl Payload { - pub fn check(self) -> bool { - let Payload(schemas, r1, r2) = self; - unify(evaluate(r1, &schemas.clone().into()), evaluate(r2, &schemas.into())) - } -} From cff77ee0ad67aab282ebd5b4148e5af748b25da6 Mon Sep 17 00:00:00 2001 From: Shuxian Wang Date: Tue, 6 Jun 2023 21:39:55 -0700 Subject: [PATCH 04/11] Add basic aggregation support. --- flake.lock | 6 +- flake.nix | 2 +- src/pipeline.rs | 23 ++- src/pipeline/normal.rs | 359 +++++++++++++++++++++++---------------- src/pipeline/null.rs | 6 +- src/pipeline/partial.rs | 171 ++++++++++++------- src/pipeline/relation.rs | 282 +++++++++++++++++------------- src/pipeline/shared.rs | 187 ++++++++++---------- src/pipeline/stable.rs | 280 ++++++++++++++++++------------ src/pipeline/syntax.rs | 83 ++++----- src/pipeline/unify.rs | 233 ++++++++++++++----------- 11 files changed, 927 insertions(+), 705 deletions(-) diff --git a/flake.lock b/flake.lock index 811e65d..e2c1092 100644 --- a/flake.lock +++ b/flake.lock @@ -82,11 +82,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1682109806, - "narHash": "sha256-d9g7RKNShMLboTWwukM+RObDWWpHKaqTYXB48clBWXI=", + "lastModified": 1684464849, + "narHash": "sha256-f8th/GWE9M2hePTMZc0YyFboigt9AG/ioEcyHcdFK2I=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2362848adf8def2866fabbffc50462e929d7fffb", + "rev": "b969a89c3e84a121c9b3af2e4ef277cd822b988a", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 1d71181..451a481 100644 --- a/flake.nix +++ b/flake.nix @@ -37,7 +37,7 @@ devShells.default = pkgs.mkShell { inputsFrom = [ cosette-prover ]; - packages = with pkgs; [ rust-analyzer julia-bin ] ++ lib.optionals stdenv.isLinux [ linuxPackages.perf ]; + packages = with pkgs; [ rust-analyzer julia-bin jless ] ++ lib.optionals stdenv.isLinux [ linuxPackages.perf ]; }; }); diff --git a/src/pipeline.rs b/src/pipeline.rs index 683cbc4..fe73f71 100644 --- a/src/pipeline.rs +++ b/src/pipeline.rs @@ -43,7 +43,7 @@ pub fn unify(Input { schemas, queries: (rel1, rel2), help }: Input) -> bool { } log::info!("Syntax left:\n{}", rel1); log::info!("Syntax right:\n{}", rel2); - let nom_env = &normal::Env(vector![], schemas.clone().into()); + let nom_env = &vector![]; let eval_nom = |rel: syntax::Relation| -> normal::Relation { let rel = (&partial::Env::default()).eval(rel); nom_env.eval(rel) @@ -55,14 +55,17 @@ pub fn unify(Input { schemas, queries: (rel1, rel2), help }: Input) -> bool { if rel1 == rel2 { return true; } + let config = Config::new(); + let z3_ctx = &Context::new(&config); + let ctx = Rc::new(Ctx::new(Solver::new(z3_ctx))); + let h_ops = Rc::new(RefCell::new(HashMap::new())); + let agg_ops = Rc::new(RefCell::new(HashMap::new())); + let rel_h_ops = Rc::new(RefCell::new(HashMap::new())); let eval_stb = |nom: normal::Relation| -> normal::Relation { - let mut config = Config::new(); - config.set_timeout_msec(2000); - let z3_ctx = &Context::new(&config); - let ctx = Rc::new(Ctx::new(Solver::new(z3_ctx))); - let h_ops = Rc::new(RefCell::new(HashMap::new())); - let rel_h_ops = Rc::new(RefCell::new(HashMap::new())); - let env = &stable::Env(vector![], 0, Z3Env(ctx, vector![], h_ops, rel_h_ops)); + let env = &stable::Env(vector![], { + let subst = vector![]; + Z3Env(ctx.clone(), subst, h_ops.clone(), agg_ops.clone(), rel_h_ops.clone()) + }); let stb = env.eval(nom); nom_env.eval(stb) }; @@ -73,10 +76,6 @@ pub fn unify(Input { schemas, queries: (rel1, rel2), help }: Input) -> bool { if rel1 == rel2 { return true; } - let mut config = Config::new(); - config.set_timeout_msec(4000); - let z3_ctx = Context::new(&config); - let ctx = Rc::new(Ctx::new(Solver::new(&z3_ctx))); let env = UnifyEnv(ctx, vector![], vector![]); env.unify(&rel1, &rel2) } diff --git a/src/pipeline/normal.rs b/src/pipeline/normal.rs index 222c230..7e36f12 100644 --- a/src/pipeline/normal.rs +++ b/src/pipeline/normal.rs @@ -7,54 +7,85 @@ use std::rc::Rc; use anyhow::bail; use imbl::{vector, HashSet, Vector}; use indenter::indented; -use itertools::{Either, Itertools}; +use itertools::Itertools; use num::ToPrimitive; use z3::ast::{exists_const, Ast, Bool, Dynamic, Int, Real as Re, String as Str}; use z3::{Config, Context, Solver}; -use super::shared::{Ctx, Lambda}; -use super::stable; +use super::shared::{Ctx, Lambda, Sigma, Typed}; +use super::stable::{self, stablize}; use super::unify::{Unify, UnifyEnv}; -use crate::pipeline::shared::{DataType, Eval, Head, Schema, Terms, VL}; +use crate::pipeline::shared::{DataType, Eval, Neutral as Neut, Terms, VL}; use crate::pipeline::{partial, shared}; pub type Relation = Lambda; -pub type Expr = shared::Expr; -pub type Neutral = shared::Neutral; -pub type Logic = shared::Logic; +pub type Expr = shared::Expr; +pub type Neutral = shared::Neutral; +pub type Head = shared::Head; +pub type Logic = shared::Logic; +pub type Term = Sigma; pub type UExpr = Terms; impl UExpr { pub fn under(scope: Vector, terms: UExpr) -> Self { - terms.into_iter().map(|term| Term { scope: scope.clone() + term.scope, ..term }).collect() + terms.into_iter().map(|term| Sigma(scope.clone() + term.0, term.1)).collect() } } #[derive(Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)] -pub struct Term { - pub scope: Vector, +pub struct Aggr(pub String, pub Vector, pub Box, pub Box); + +impl Display for Aggr { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + let Aggr(name, scope, uexpr, expr) = self; + write!(f, "⨿{} {:?} {{", name, scope)?; + writeln!(indented(f).with_str("\t"), "{},", uexpr)?; + writeln!(indented(f).with_str("\t"), "{}", expr)?; + write!(f, "}}") + } +} + +impl Typed for Aggr { + fn ty(&self) -> DataType { + self.3.ty() + } +} + +impl Aggr { + pub fn under(scope: Vector, aggs: Vector) -> Vector { + aggs.into_iter().map(|Aggr(op, scp, u, e)| Aggr(op, scope.clone() + scp, u, e)).collect() + } +} + +#[derive(Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)] +pub struct Inner { pub logic: Logic, pub apps: Vector, } -impl Term { - pub fn app(app: Neutral) -> Self { - Term { scope: vector![], logic: Logic::And(vector![]), apps: vector![app] } +impl Display for Inner { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + write!(f, "⟦{}⟧ × ({})", self.logic, self.apps.iter().format(" × ")) } } -impl Display for Term { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - writeln!(f, "∑ {:?} {{", self.scope)?; - writeln!( - indented(f).with_str("\t"), - "⟦{}⟧ × {}", - self.logic, - self.apps.iter().format(" × ") - )?; - write!(f, "}}") +impl Inner { + pub(crate) fn in_scope(&self, lvl: usize) -> bool { + self.logic.in_scope(lvl) && self.apps.iter().all(|app| app.in_scope(lvl)) + } +} + +impl Aggr { + pub(crate) fn deps(&self, vars: &Range) -> HashSet { + let Aggr(_, _, u, e) = self; + e.deps(vars) + u.logic.deps(vars) + HashSet::unions(u.apps.iter().map(|app| app.deps(vars))) + } + + pub(crate) fn in_scope(&self, lvl: usize) -> bool { + let Aggr(_, scope, u, e) = self; + u.in_scope(lvl + scope.len()) && e.in_scope(lvl + scope.len()) } } @@ -64,6 +95,7 @@ impl Expr { Expr::Var(v, _) if vars.contains(&v.0) => HashSet::unit(*v), Expr::Var(_, _) => HashSet::new(), Expr::Log(l) => l.deps(vars), + Expr::Agg(agg) => agg.deps(vars), Expr::Op(_, args, _) => HashSet::unions(args.iter().map(|arg| arg.deps(vars))), Expr::HOp(_, args, rel, _) => { HashSet::unions(args.iter().map(|arg| arg.deps(vars))) + rel.deps(vars) @@ -75,6 +107,7 @@ impl Expr { match self { Expr::Var(VL(l), _) => *l < lvl, Expr::Log(l) => l.in_scope(lvl), + Expr::Agg(agg) => agg.in_scope(lvl), Expr::Op(_, args, _) => args.iter().all(|arg| arg.in_scope(lvl)), Expr::HOp(_, args, rel, _) => { args.iter().all(|arg| arg.in_scope(lvl)) && rel.in_scope(lvl) @@ -82,7 +115,7 @@ impl Expr { } } - pub(crate) fn exprs(&self) -> Vector<&Expr> { + fn exprs(&self) -> Vector<&Expr> { match self { Expr::Log(l) => l.exprs(), Expr::Op(op, es, ty) if op == "=" && es.len() == 2 && ty == &DataType::Boolean => { @@ -105,7 +138,7 @@ impl UExpr { self.iter().all(|t| t.in_scope(lvl)) } - pub(crate) fn exprs(&self) -> Vector<&Expr> { + fn exprs(&self) -> Vector<&Expr> { self.iter().flat_map(Term::exprs).collect() } } @@ -120,52 +153,58 @@ impl Relation { body.in_scope(lvl + scope.len()) } - pub(crate) fn exprs(&self) -> Vector<&Expr> { + fn exprs(&self) -> Vector<&Expr> { self.1.exprs() } } impl Term { fn deps(&self, vars: &Range) -> HashSet { - self.logic.deps(vars) + HashSet::unions(self.apps.iter().map(|app| app.deps(vars))) + let Sigma(_, Inner { logic, apps }) = self; + logic.deps(vars) + HashSet::unions(apps.iter().map(|app| app.deps(vars))) } fn in_scope(&self, lvl: usize) -> bool { - let lvl = lvl + self.scope.len(); - self.logic.in_scope(lvl) && self.apps.iter().all(|app| app.in_scope(lvl)) + let Sigma(scope, Inner { logic, apps }) = self; + let lvl = lvl + scope.len(); + logic.in_scope(lvl) && apps.iter().all(|app| app.in_scope(lvl)) } - pub(crate) fn exprs(&self) -> Vector<&Expr> { - self.logic.exprs() + self.apps.iter().flat_map(Neutral::exprs).collect() + fn exprs(&self) -> Vector<&Expr> { + let Sigma(scope, Inner { logic, apps }) = self; + logic.exprs() + apps.iter().flat_map(Neutral::exprs).collect() } } impl Neutral { fn deps(&self, vars: &Range) -> HashSet { - (match &self.head { + let Neut(head, args) = self; + (match &head { Head::Var(_) => HashSet::new(), Head::HOp(_, args, rel) => { rel.deps(vars) + HashSet::unions(args.iter().map(|arg| arg.deps(vars))) }, - }) + HashSet::unions(self.args.iter().map(|arg| arg.deps(vars))) + }) + HashSet::unions(args.iter().map(|arg| arg.deps(vars))) } fn in_scope(&self, lvl: usize) -> bool { - (match &self.head { + let Neut(head, args) = self; + (match &head { Head::Var(_) => true, Head::HOp(_, args, rel) => { args.iter().all(|arg| arg.in_scope(lvl)) && rel.in_scope(lvl) }, - }) && self.args.iter().all(|arg| arg.in_scope(lvl)) + }) && args.iter().all(|arg| arg.in_scope(lvl)) } - pub(crate) fn exprs(&self) -> Vector<&Expr> { - (match &self.head { + fn exprs(&self) -> Vector<&Expr> { + let Neut(head, args) = self; + (match &head { Head::Var(_) => vector![], Head::HOp(_, args, rel) => { args.iter().flat_map(Expr::exprs).chain(rel.exprs()).collect() }, - }) + self.args.iter().flat_map(Expr::exprs).collect() + }) + args.iter().flat_map(Expr::exprs).collect() } } @@ -179,7 +218,6 @@ impl Logic { Neg(l) => l.deps(vars), And(ls) | Or(ls) => HashSet::unions(ls.iter().map(|l| l.deps(vars))), Squash(u) => u.deps(vars), - Exists(rel) => rel.deps(vars), } } @@ -192,7 +230,32 @@ impl Logic { Neg(l) => l.in_scope(lvl), And(ls) | Or(ls) => ls.iter().all(|l| l.in_scope(lvl)), Squash(u) => u.in_scope(lvl), - Exists(rel) => rel.in_scope(lvl), + } + } + + fn simpl(self) -> Self { + use shared::Logic::*; + match self { + Eq(e1, e2) if e1 == e2 => Logic::tt(), + Bool(Expr::Op(p, es, _)) if p == "=" && es.len() == 2 && es[0] == es[1] => { + !es[0].clone().is_null() + }, + And(ls) => And(ls + .into_iter() + .flat_map(|l| match l.simpl() { + And(ls) => ls, + l => vector![l], + }) + .collect()), + Or(ls) => Or(ls + .into_iter() + .flat_map(|l| match l.simpl() { + Or(ls) => ls, + l => vector![l], + }) + .collect()), + Neg(l) => Neg(l.simpl().into()), + l => l, } } @@ -206,46 +269,36 @@ impl Logic { And(ls) => ls.iter().flat_map(Logic::exprs).collect(), Or(ls) => ls.iter().flat_map(Logic::exprs).collect(), Squash(u) => u.exprs(), - Exists(Lambda(_, u)) => u.exprs(), } } } -#[derive(Clone)] -pub struct Env(pub Vector, pub Vector); +pub type Env = Vector; -impl Env { - pub fn extend(&self, scope: Vector) -> Env { - Env(self.0.clone() + scope, self.1.clone()) +impl Eval for &Env { + fn eval(self, agg: partial::Aggr) -> Expr { + use shared::Expr::*; + let op = agg.0.clone(); + let ty = agg.ty(); + let es = Agg(agg).split(&op, self).into_iter().map(|(scp, l, apps, e)| { + let env = &(self + &scp); + let inner = Inner { logic: env.eval(l), apps: env.eval(apps) }; + Agg(Aggr(op.clone(), scp, Box::new(inner), Box::new(env.eval(e)))) + }); + Op(op.clone(), es.collect(), ty) } } impl Eval for &Env { fn eval(self, source: partial::UExpr) -> UExpr { - source.into_iter().flat_map(|t| helper(self, t, vector![])).collect() - } -} - -fn helper(env: &Env, mut term: partial::Term, apps: Vector) -> UExpr { - let Env(context, schemas) = env; - if let Some(summand) = term.sums.pop_front() { - let scope = summand.scope(schemas); - let vars = shared::Expr::vars(context.len(), scope.clone()); - let env = &env.extend(scope.clone()); - let body = (summand.app(vars) * term) + source .into_iter() - .flat_map(|t| helper(env, t, apps.clone())) - .collect(); - UExpr::under(scope, body) - } else if let Some(app) = term.apps.pop_front() { - match app.head.app(app.args, env) { - Either::Left(app) => helper(env, term, apps + vector![app]), - Either::Right(uexpr) => { - (uexpr * term).into_iter().flat_map(|t| helper(env, t, apps.clone())).collect() - }, - } - } else { - UExpr::term(Term { scope: vector![], logic: env.eval(term.logic), apps: env.eval(apps) }) + .flat_map(|t| t.split(self)) + .map(|(scp, l, apps)| { + let env = &(self + &scp); + Sigma(scp, Inner { logic: env.eval(l), apps: env.eval(apps) }) + }) + .collect() } } @@ -257,63 +310,67 @@ impl Eval<(VL, DataType), Expr> for &Env { impl Eval for &Env { fn eval(self, source: partial::Relation) -> Relation { - use partial::Relation::*; - let Env(context, schemas) = self; - let scope = source.scope(schemas); - let env = &self.extend(scope.clone()); - let vars = shared::Expr::vars(context.len(), scope.clone()); - Lambda(scope, match source { - Rigid(head) => match head.app(vars, env) { - Either::Left(app) => UExpr::term(Term::app(env.eval(app))), - Either::Right(uexpr) => env.eval(uexpr), - }, - Lam(scope, clos_env, body) => { - let vars = shared::Expr::vars(context.len(), scope); - let body: partial::UExpr = (&clos_env.append(vars)).eval(body); - env.eval(body) - }, - }) + let partial::Relation(scope, clos_env, body) = source; + let env = &(self + &scope); + let vars = shared::Expr::vars(self.len(), scope.clone()); + let body: partial::UExpr = (&clos_env.append(vars)).eval(body); + Lambda(scope, env.eval(body)) } } impl<'c> Eval, Relation> for &Env { fn eval(self, stable::Relation(scope, env, body): stable::Relation<'c>) -> Relation { - let lvl = self.0.len(); - let body = (&env.extend(lvl, scope.clone())).eval(body); - Lambda(scope.clone(), (&self.extend(scope)).eval(body)) + let body = (&env.extend(self.len(), scope.clone())).eval(body); + Lambda(scope.clone(), (&(self + &scope)).eval(body)) } } impl<'c> Eval, UExpr> for &Env { fn eval(self, source: stable::UExpr<'c>) -> UExpr { - source.into_iter().map(|t| self.eval(t)).collect() + source.into_iter().filter_map(|t| self.eval(t)).collect() } } -impl<'c> Eval, Term> for &Env { - fn eval(self, source: stable::Term<'c>) -> Term { - let scope = source.scope; - let env = &self.extend(scope.clone()); - let logic = env.eval(source.logic); - let apps = env.eval(source.apps); - Term { scope, logic, apps } +impl<'c> Eval, Option> for &Env { + fn eval(self, stable::Term(scope, clos_env, inner): stable::Term<'c>) -> Option { + let (new_scope, new_subst) = stablize(&clos_env, scope.clone(), self, inner.logic.clone())?; + let stable::Env(subst, z3_env) = clos_env; + let clos_env = &stable::Env(subst + new_subst, z3_env.extend(&scope)); + let env = &(self + &new_scope); + let logic = env.eval(clos_env.eval(inner.logic)).simpl(); + let apps = env.eval(clos_env.eval(inner.apps)); + Some(Sigma(new_scope, Inner { logic, apps })) } } -impl Unify for &Env { - fn unify(self, t1: partial::UExpr, t2: partial::UExpr) -> bool { - let Env(context, _) = self; - let t1: UExpr = self.eval(t1); - let t2: UExpr = self.eval(t2); +impl<'c> Eval, Expr> for &Env { + fn eval(self, agg: stable::Aggr<'c>) -> Expr { + use shared::Expr::*; + let op = agg.0.clone(); + let ty = agg.ty(); + let es = Agg(agg).split(&op, self).into_iter().map(|(scp, l, apps, e)| { + let env = &(self + &scp); + let inner = Inner { logic: env.eval(l), apps: env.eval(apps) }; + Agg(Aggr(op.clone(), scp, Box::new(inner), Box::new(env.eval(e)))) + }); + Op(op.clone(), es.collect(), ty) + } +} + +impl Unify for Env { + fn unify(&self, t1: &partial::UExpr, t2: &partial::UExpr) -> bool { + let t1: UExpr = self.eval(t1.clone()); + let t2: UExpr = self.eval(t2.clone()); let config = Config::new(); let z3_ctx = Context::new(&config); let ctx = Rc::new(Ctx::new(Solver::new(&z3_ctx))); let h_ops = Rc::new(RefCell::new(HashMap::new())); + let agg_ops = Rc::new(RefCell::new(HashMap::new())); let rel_h_ops = Rc::new(RefCell::new(HashMap::new())); - let uexpr_subst = shared::Expr::vars(0, context.clone()).into_iter().map(Some).collect(); - let z3_subst: Vector<_> = context.iter().map(|ty| ctx.var(ty, "v")).collect(); + let subst = shared::Expr::vars(0, self.clone()).into_iter().map(Some).collect(); + let z3_subst: Vector<_> = self.iter().map(|ty| ctx.var(ty, "v")).collect(); let env = - &stable::Env(uexpr_subst, 0, Z3Env(ctx.clone(), z3_subst.clone(), h_ops, rel_h_ops)); + &stable::Env(subst, Z3Env(ctx.clone(), z3_subst.clone(), h_ops, agg_ops, rel_h_ops)); let t1 = env.eval(t1); let t2 = env.eval(t2); let t1: UExpr = self.eval(t1); @@ -328,37 +385,44 @@ pub type HOpMap<'c> = HashMap<(String, Vec, Relation, Vector>) pub type RelHOpMap<'c> = HashMap<(String, Vec, Relation, Vector>, bool), (String, Vec)>; +pub type AggMap<'c> = + HashMap<(String, Lambda<(Inner, Vec)>, Vector>), Dynamic<'c>>; + #[derive(Clone)] pub struct Z3Env<'c>( pub Rc>, pub Vector>, pub Rc>>, + pub Rc>>, pub Rc>>, ); impl<'c> Z3Env<'c> { pub fn extend(&self, scope: &Vector) -> Self { let vars = scope.into_iter().map(|ty| self.0.var(ty, "v")).collect(); - Z3Env(self.0.clone(), self.1.clone() + vars, self.2.clone(), self.3.clone()) + Z3Env(self.0.clone(), self.1.clone() + vars, self.2.clone(), self.3.clone(), self.4.clone()) } pub fn extend_vals(&self, vals: &Vector>) -> Self { - Z3Env(self.0.clone(), &self.1 + vals, self.2.clone(), self.3.clone()) + Z3Env(self.0.clone(), &self.1 + vals, self.2.clone(), self.3.clone(), self.4.clone()) } pub fn extend_vars(&self, scope: &Vector) -> (Z3Env<'c>, Vector>) { let vars = scope.into_iter().map(|ty| self.0.var(ty, "v")).collect(); - (Z3Env(self.0.clone(), &self.1 + &vars, self.2.clone(), self.3.clone()), vars) + ( + Z3Env(self.0.clone(), &self.1 + &vars, self.2.clone(), self.3.clone(), self.4.clone()), + vars, + ) } } impl<'c> Eval<&Logic, Bool<'c>> for &Z3Env<'c> { fn eval(self, source: &Logic) -> Bool<'c> { use shared::Logic::*; - let Z3Env(ctx, _, _, _) = self; + let Z3Env(ctx, _, _, _, _) = self; let z3_ctx = ctx.z3_ctx(); match source { - Bool(e) => self.0.bool_is_true(&self.eval(e)), + Bool(e) => ctx.bool_is_true(&self.eval(e)), Eq(e1, e2) => { assert_eq!(e1.ty(), e2.ty(), "{} and {} have different types", e1, e2); self.eval(e1)._eq(&self.eval(e2)) @@ -366,13 +430,12 @@ impl<'c> Eval<&Logic, Bool<'c>> for &Z3Env<'c> { Pred(p, args) => { let args = args.iter().map(|arg| self.eval(arg)).collect_vec(); let args = args.iter().collect_vec(); - self.0.app(p, &args, &DataType::Boolean, false).as_bool().unwrap() + ctx.app(p, &args, &DataType::Boolean, false).as_bool().unwrap() }, Neg(l) => self.eval(l.as_ref()).not(), And(ls) => z3::ast::Bool::and(z3_ctx, &self.eval(ls).iter().collect_vec()), Or(ls) => z3::ast::Bool::or(z3_ctx, &self.eval(ls).iter().collect_vec()), Squash(u) => self.eval(u.as_ref()), - Exists(Lambda(scope, l)) => self.eval(&UExpr::under(scope.clone(), l.clone())), } } } @@ -387,11 +450,16 @@ impl<'c> Eval<&UExpr, Bool<'c>> for &Z3Env<'c> { impl<'c> Eval<&Term, Bool<'c>> for &Z3Env<'c> { fn eval(self, source: &Term) -> Bool<'c> { let z3_ctx = self.0.z3_ctx(); - let (ref env, vars) = self.extend_vars(&source.scope); - let logic = env.eval(&source.logic); - let apps = env.eval(&source.apps); + let Sigma(scope, body) = source; + let (ref env, vars) = self.extend_vars(scope); let bounds = vars.iter().map(|v| v as &dyn Ast).collect_vec(); - exists_const(z3_ctx, &bounds, &[], &Bool::and(z3_ctx, &[&logic, &apps])) + exists_const(z3_ctx, &bounds, &[], &env.eval(body)) + } +} + +impl<'c> Eval<&Inner, Bool<'c>> for &Z3Env<'c> { + fn eval(self, source: &Inner) -> Bool<'c> { + Bool::and(self.0.z3_ctx(), &[&self.eval(&source.logic), &self.eval(&source.apps)]) } } @@ -419,13 +487,8 @@ impl<'c> Eval<&Vector, Int<'c>> for &Z3Env<'c> { } } -fn table_name( - head: &Head, - env: &Z3Env, - squashed: bool, - domain: Vec, -) -> String { - let Z3Env(_, subst, _, map) = env; +fn table_name(head: &Head, env: &Z3Env, squashed: bool, domain: Vec) -> String { + let Z3Env(_, subst, _, _, map) = env; match head { Head::Var(VL(l)) => format!("r{}!{}", if squashed { "p" } else { "" }, l), Head::HOp(op, args, rel) => { @@ -441,29 +504,24 @@ fn table_name( } impl<'c> Eval<&Neutral, Bool<'c>> for &Z3Env<'c> { - fn eval(self, source: &Neutral) -> Bool<'c> { - let domain = source.args.iter().map(|a| a.ty()).collect(); - let args = source.args.iter().map(|v| self.eval(v)).collect_vec(); + fn eval(self, shared::Neutral(head, args): &Neutral) -> Bool<'c> { + let domain = args.iter().map(|a| a.ty()).collect(); + let args = args.iter().map(|v| self.eval(v)).collect_vec(); let args = args.iter().collect_vec(); self.0 - .app( - &(table_name(&source.head, self, true, domain) + "p"), - &args, - &DataType::Boolean, - false, - ) + .app(&(table_name(&head, self, true, domain) + "p"), &args, &DataType::Boolean, false) .as_bool() .unwrap() } } impl<'c> Eval<&Neutral, Int<'c>> for &Z3Env<'c> { - fn eval(self, source: &Neutral) -> Int<'c> { - let domain = source.args.iter().map(|a| a.ty()).collect(); - let args = source.args.iter().map(|v| self.eval(v)).collect_vec(); + fn eval(self, shared::Neutral(head, args): &Neutral) -> Int<'c> { + let domain = args.iter().map(|a| a.ty()).collect(); + let args = args.iter().map(|v| self.eval(v)).collect_vec(); let args = args.iter().collect_vec(); self.0 - .app(&table_name(&source.head, self, false, domain), &args, &DataType::Integer, false) + .app(&table_name(&head, self, false, domain), &args, &DataType::Integer, false) .as_int() .unwrap() } @@ -472,7 +530,7 @@ impl<'c> Eval<&Neutral, Int<'c>> for &Z3Env<'c> { impl<'c> Eval<&Expr, Dynamic<'c>> for &Z3Env<'c> { fn eval(self, source: &Expr) -> Dynamic<'c> { use DataType::*; - let Z3Env(ctx, subst, h_ops, _) = self; + let Z3Env(ctx, subst, h_ops, agg_ops, _) = self; let parse = |ctx: &Ctx<'c>, input: &str, ty: &DataType| -> anyhow::Result> { if input.to_lowercase() == "null" { let null = match ty { @@ -502,7 +560,7 @@ impl<'c> Eval<&Expr, Dynamic<'c>> for &Z3Env<'c> { }) }; match source { - Expr::Var(v, _) => subst[v.0].clone(), + Expr::Var(VL(l), _) => subst[*l].clone(), Expr::Log(l) => ctx.bool_some(self.eval(l.as_ref())), Expr::Op(op, args, ty) if args.is_empty() => parse(ctx.as_ref(), op, ty) .unwrap_or_else(|_| ctx.app(&format!("f!{}", op), &[], ty, true)), @@ -543,8 +601,6 @@ impl<'c> Eval<&Expr, Dynamic<'c>> for &Z3Env<'c> { "<=" => ctx.real_le(args[0], args[1]), _ => unreachable!(), }, - // "=" => ctx.bool_some(args[0]._eq(args[1])), - // "<>" | "!=" => ctx.bool_some(args[0]._eq(args[1]).not()), cmp @ ("=" | "<>" | "!=") => { let (a1, a2) = (args[0], args[1]); assert_eq!(a1.get_sort(), a2.get_sort(), "{} and {} have different types.", expr_args[0], expr_args[1]); @@ -566,18 +622,19 @@ impl<'c> Eval<&Expr, Dynamic<'c>> for &Z3Env<'c> { ctx.bool_is_true(cond).ite(body, &rem) }) }, - "IS NULL" => { - ctx.bool_some(ctx.none(&expr_args[0].ty()).unwrap()._eq(args[0])) - }, - "IS NOT NULL" => { - ctx.bool_some(ctx.none(&expr_args[0].ty()).unwrap()._eq(args[0]).not()) - }, "CAST" if ty == &expr_args[0].ty() => { args[0].clone() }, "CAST" if ty == &Real && expr_args[0].ty() == Integer => { ctx.int_to_real(args[0]) }, + "COUNT" | "SUM" | "MIN" | "MAX" => { + if args.len() == 1 { + args[0].clone() + } else { + ctx.app(&format!("f{}!{}", args.len(), op), &args, ty, true) + } + } op => ctx.app(&format!("f!{}", op), &args, ty, true), } }, @@ -608,6 +665,18 @@ impl<'c> Eval<&Expr, Dynamic<'c>> for &Z3Env<'c> { .entry((f.clone(), args.clone(), *rel.clone(), subst.clone())) .or_insert_with(|| self.0.var(ty, "h")) .clone(), + Expr::Agg(agg) => { + let Aggr(f, scope, inner, expr) = agg; + agg_ops + .borrow_mut() + .entry(( + f.clone(), + Lambda(scope.clone(), (*inner.clone(), vec![*expr.clone()])), + subst.clone(), + )) + .or_insert_with(|| self.0.var(&expr.ty(), "h")) + .clone() + }, } } } diff --git a/src/pipeline/null.rs b/src/pipeline/null.rs index f87f533..0670a72 100644 --- a/src/pipeline/null.rs +++ b/src/pipeline/null.rs @@ -144,8 +144,6 @@ ctx_impl!( }; Bool { not(x) -> Bool; - // and[x, y] -> Bool; - // or[x, y] -> Bool; _eq(x, y) -> Bool; }; String { @@ -204,9 +202,7 @@ impl<'c> Ctx<'c> { let ctx = self.solver.get_context(); self.bool.variants[0].tester.apply(&[expr]).as_bool().unwrap().ite( &Bool::from_bool(ctx, false), - &self.bool.variants[1].accessors[0] - .apply(&[expr]) - ._eq(&Bool::from_bool(ctx, true).into()), + &self.bool.variants[1].accessors[0].apply(&[expr]).as_bool().unwrap(), ) } diff --git a/src/pipeline/partial.rs b/src/pipeline/partial.rs index fefed46..27bedf4 100644 --- a/src/pipeline/partial.rs +++ b/src/pipeline/partial.rs @@ -1,62 +1,36 @@ use std::ops::Mul; use imbl::{vector, Vector}; -use itertools::Either; -use super::shared::Schema; -use crate::pipeline::shared::{DataType, Eval, Terms, VL}; +use super::shared::{Lambda, Schema}; +use crate::pipeline::shared::{DataType, Eval, Neutral as Neut, Terms, Typed, VL}; use crate::pipeline::unify::Unify; use crate::pipeline::{normal, shared, syntax}; -pub type Expr = shared::Expr; -pub type Head = shared::Head; -pub type Neutral = shared::Neutral; -pub type Logic = shared::Logic; - -impl Head { - pub fn app(self, args: Vector, env: &normal::Env) -> Either { - use shared::Head::*; - match self { - HOp(op, args, _) if op == "limit" && args[0] == 0u32.into() => { - Either::Right(UExpr::zero()) - }, - HOp(op, h_args, rel) - if ((op == "limit" && h_args[0] == 1u32.into()) && rel.degen(env)) - || (op == "offset" && h_args[0] == 0u32.into()) => - { - Either::Right(rel.app(args)) - }, - _ => Either::Left(Neutral::new(self, args)), - } - } -} - #[derive(Debug, Clone, Eq, PartialEq)] -pub enum Relation { - Rigid(Head), - Lam(Vector, Env, syntax::UExpr), +pub struct Relation(pub Vector, pub Env, pub syntax::UExpr); +#[derive(Debug, Clone, Eq, PartialEq)] +pub struct Aggr(pub String, pub Vector, pub Env, pub syntax::UExpr, pub syntax::Expr); +pub type Expr = shared::Expr; +pub type Logic = shared::Logic; +pub type Head = shared::Head; +pub type Neutral = shared::Neutral; + +impl Typed for Aggr { + fn ty(&self) -> DataType { + self.4.ty() + } } impl Relation { pub fn app(self, args: Vector) -> UExpr { - use Relation::*; - match self { - Rigid(head) => UExpr::apply(head, args), - Lam(_, env, body) => (&env.append(args)).eval(body), - } + let Relation(_, env, body) = self; + (&env.append(args)).eval(body) } - pub fn scope(&self, schemas: &Vector) -> Vector { - use Relation::*; - match self { - Rigid(Head::Var(l)) => schemas[l.0].types.clone().into(), - Rigid(Head::HOp(_, _, rel)) => rel.scope(schemas), - Lam(scopes, _, _) => scopes.clone(), - } - } - - fn degen(&self, env: &normal::Env) -> bool { - env.unify(UExpr::sum(self.clone()), UExpr::logic(Logic::Exists(self.clone()))) + pub fn degen(&self, env: &normal::Env) -> bool { + let sum = UExpr::sum(self.clone()); + env.unify(&sum.clone(), &UExpr::logic(Logic::squash(sum))) } } @@ -72,8 +46,8 @@ impl UExpr { UExpr::term(Term { sums: vector![summand], ..Term::default() }) } - pub fn apply(head: Head, args: Vector) -> Self { - UExpr::term(Term { apps: vector![Neutral { head, args }], ..Term::default() }) + pub fn neutral(head: Head, args: Vector) -> Self { + UExpr::term(Term { apps: vector![Neut(head, args)], ..Term::default() }) } } @@ -101,6 +75,82 @@ impl Mul for Term { } } +pub type NormAgg = (Vector, Logic, Vector, Expr); + +impl Expr { + pub fn split(self, aop: &str, context: &Vector) -> Vector { + match self { + Expr::Op(op, args, _) if op == aop => { + args.into_iter().flat_map(|arg| arg.split(aop, context)).collect() + }, + Expr::Agg(Aggr(op, scope, env, u, e)) if op == aop => { + let vars = shared::Expr::vars(context.len(), scope.clone()); + let env = &env.append(vars); + let e = env.eval(e); + let context = &(context + &scope); + env.eval(u) + .into_iter() + .flat_map(|t| t.split(context)) + .flat_map(|(scp1, l1, apps1)| { + let scope = &scope; + e.clone().split(aop, &(context + &scp1)).into_iter().map( + move |(scp2, l2, apps2, e)| { + ( + scope + &scp1 + scp2, + Logic::And(vector![l1.clone(), l2]), + &apps1 + &apps2, + e, + ) + }, + ) + }) + .collect() + }, + _ => vector![(vector![], Logic::tt(), vector![], self)], + } + } +} + +pub type NormTerm = (Vector, Logic, Vector); + +impl Term { + pub fn split(self, context: &Vector) -> Vector { + self.splitter(context, vector![]) + } + + fn splitter(mut self, context: &Vector, apps: Vector) -> Vector { + if let Some(app) = self.apps.pop_front() { + match app.0 { + Head::HOp(op, args, _) if op == "limit" && args[0] == 0u32.into() => vector![], + Head::HOp(op, h_args, rel) + if ((op == "limit" && h_args[0] == 1u32.into()) && rel.degen(&context)) + || (op == "offset" && h_args[0] == 0u32.into()) => + { + (rel.app(app.1.clone()) * self) + .into_iter() + .flat_map(|t| t.splitter(context, apps.clone())) + .collect() + }, + _ => self.splitter(context, apps + vector![app]), + } + } else if let Some(summand) = self.sums.pop_front() { + let scope = summand.0.clone(); + let vars = shared::Expr::vars(context.len(), scope.clone()); + let context = &(context + &scope); + (summand.app(vars) * self) + .into_iter() + .flat_map(|t| { + t.splitter(context, apps.clone()) + .into_iter() + .map(|(s, l, a)| (&scope + &s, l, a)) + }) + .collect() + } else { + vector![(vector![], self.logic, apps)] + } + } +} + #[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct Env(Vector, Vector); @@ -122,12 +172,10 @@ impl Eval for &Env { Mul(us) => us.into_iter().map(|u| self.eval(u)).fold(UExpr::one(), UExpr::mul), Squash(u) => UExpr::logic(Logic::squash(self.eval(*u))), Not(u) => UExpr::logic(!Logic::squash(self.eval(*u))), - Sum(scopes, body) => UExpr::sum(Relation::Lam(scopes, self.clone(), *body)), - Pred(logic) => UExpr::logic(self.eval(logic)), - App(table, args) => { - let rel: Relation = self.eval(table); - rel.app(self.eval(args)) - }, + Sum(scope, body) => UExpr::sum(Relation(scope, self.clone(), *body)), + Pred(logic) => UExpr::logic(self.eval(*logic)), + App(table, args) => self.eval(*table).app(self.eval(args)), + Neu(Neut(head, args)) => UExpr::neutral(self.eval(head), self.eval(args)), } } } @@ -139,15 +187,14 @@ impl Eval<(VL, DataType), Expr> for &Env { } } +impl Eval for &Env { + fn eval(self, syntax::Aggr(op, scope, u, e): syntax::Aggr) -> Expr { + Expr::Agg(Aggr(op, scope, self.clone(), u, *e)) + } +} + impl Eval for &Env { - fn eval(self, source: syntax::Relation) -> Relation { - use syntax::Relation::*; - match source { - Var(t) => Relation::Rigid(Head::Var(t)), - HOp(name, args, rel) => { - Relation::Rigid(Head::HOp(name, self.eval(args), self.eval(rel))) - }, - Lam(scopes, body) => Relation::Lam(scopes, self.clone(), *body), - } + fn eval(self, Lambda(scope, body): syntax::Relation) -> Relation { + Relation(scope, self.clone(), body) } } diff --git a/src/pipeline/relation.rs b/src/pipeline/relation.rs index d08343b..1e11f25 100644 --- a/src/pipeline/relation.rs +++ b/src/pipeline/relation.rs @@ -5,7 +5,8 @@ use imbl::{vector, Vector}; use itertools::{Either, Itertools}; use serde::{Deserialize, Serialize}; -use crate::pipeline::shared::{DataType, Eval, Schema, VL}; +use super::syntax::Aggr; +use crate::pipeline::shared::{DataType, Eval, Head, Lambda, Neutral, Schema, Typed, VL}; use crate::pipeline::syntax::{Logic, UExpr}; use crate::pipeline::{shared, syntax}; @@ -82,30 +83,28 @@ impl Relation { impl Eval for Env<'_> { fn eval(self, source: Relation) -> syntax::Relation { - use syntax::Relation as Rel; use syntax::UExpr::*; use Relation::*; let Env(schemas, subst, lvl) = self; - let scopes = source.scope(schemas); + let scope = source.scope(schemas); match source { - Singleton => Rel::lam(vector![], UExpr::one()), + Singleton => Lambda(vector![], UExpr::one()), Scan(VL(t)) => { - let vars = vars(lvl, scopes.clone()); + let vars = vars(lvl, scope.clone()); let schema = &schemas[t]; - let conds = schema - .guaranteed - .iter() - .map(|cond| Pred(Env(schemas, &vars, lvl + scopes.len()).eval(cond.clone()))); + let conds = schema.guaranteed.iter().map(|cond| { + UExpr::pred(Env(schemas, &vars, lvl + scope.len()).eval(cond.clone())) + }); let constraints = schema.nullabilities.iter().zip(vars.clone()).map(|(nullable, v)| { if !*nullable { - Pred(!Logic::is_null(v)) + UExpr::pred(!v.is_null()) } else { UExpr::one() } }); let app = if schema.primary.is_empty() { - let app = App(Rel::Var(VL(t)), vars.clone()); + let app = UExpr::Neu(Neutral(Head::Var(VL(t)), vars.clone())); app.clone() * UExpr::squash(app) } else { let key_constraints = @@ -127,55 +126,56 @@ impl Eval for Env<'_> { }); pa.chain(once(pk)) }); - Pred(Logic::And(key_constraints.collect())) + UExpr::pred(Logic::And(key_constraints.collect())) }; - Rel::lam(scopes.clone(), app * Mul(constraints.collect()) * Mul(conds.collect())) + Lambda(scope.clone(), app * Mul(constraints.collect()) * Mul(conds.collect())) }, // Filter R(x, y) by P[x, y] // λ x, y. [P[x, y]] × R(x, y) Filter { condition, source } => { - let vars = vars(lvl, scopes.clone()); - let body_lvl = lvl + scopes.len(); + let vars = vars(lvl, scope.clone()); + let body_lvl = lvl + scope.len(); let cond_subst = subst + &vars; - let condition = UExpr::Pred(Env(schemas, &cond_subst, body_lvl).eval(condition)); + let condition = UExpr::pred(Env(schemas, &cond_subst, body_lvl).eval(condition)); let source = Env(schemas, subst, body_lvl).eval(*source); - Rel::lam(scopes, condition * UExpr::App(source, vars)) + Lambda(scope, condition * UExpr::app(source, vars)) }, // Project f[x, y] from R(x, y) // λ a. ∑ x, y. [a = f[x, y]] × R(x, y) Project { columns, source } => { - let proj_vars = vars(lvl, scopes.clone()); - let inner_scopes = source.scope(schemas); - let inner_vars = vars(lvl + scopes.len(), inner_scopes.clone()); - let inner_lvl = lvl + scopes.len() + inner_scopes.len(); + let proj_vars = vars(lvl, scope.clone()); + let inner_scope = source.scope(schemas); + let inner_vars = vars(lvl + scope.len(), inner_scope.clone()); + let inner_lvl = lvl + scope.len() + inner_scope.len(); let source = Env(schemas, subst, inner_lvl).eval(*source); let cols_subst = subst + &inner_vars; let cols_env = Env(schemas, &(cols_subst), inner_lvl); let body = proj_vars .into_iter() .zip(columns) - .map(|(var, col)| Pred(Logic::Eq(var, cols_env.eval(col)))) - .fold(UExpr::App(source, inner_vars), UExpr::mul); - Rel::lam(scopes, UExpr::sum(inner_scopes, body)) + .map(|(var, col)| UExpr::pred(Logic::Eq(var, cols_env.eval(col)))) + .fold(UExpr::app(source, inner_vars), UExpr::mul); + Lambda(scope, UExpr::sum(inner_scope, body)) }, // R(x) semi join S(y) on P[x, y] // λ x. R(x) × ‖∑ y. [P[x, y]] × S(y)‖ Join { condition, left, right, kind: kind @ (JoinKind::Semi | JoinKind::Anti) } => { - let left_vars = vars(lvl, scopes.clone()); - let body_lvl = lvl + scopes.len(); - let inner_scopes = right.scope(schemas); - let inner_lvl = body_lvl + inner_scopes.len(); - let right_vars = vars(body_lvl, inner_scopes.clone()); + let left_vars = vars(lvl, scope.clone()); + let body_lvl = lvl + scope.len(); + let inner_scope = right.scope(schemas); + let inner_lvl = body_lvl + inner_scope.len(); + let right_vars = vars(body_lvl, inner_scope.clone()); let cond_subst = subst + &(&left_vars + &right_vars); - let cond = Pred(Env(schemas, &cond_subst, inner_lvl).eval(condition)); - let right_body = App(Env(schemas, subst, inner_lvl).eval(*right), right_vars); - let left_body = App(Env(schemas, subst, body_lvl).eval(*left), left_vars); + let cond = UExpr::pred(Env(schemas, &cond_subst, inner_lvl).eval(condition)); + let right_body = + UExpr::app(Env(schemas, subst, inner_lvl).eval(*right), right_vars); + let left_body = UExpr::app(Env(schemas, subst, body_lvl).eval(*left), left_vars); let wrapper = match kind { JoinKind::Semi => UExpr::squash, JoinKind::Anti => UExpr::not, _ => unreachable!(), }; - Rel::lam(scopes, left_body * wrapper(UExpr::sum(inner_scopes, cond * right_body))) + Lambda(scope, left_body * wrapper(UExpr::sum(inner_scope, cond * right_body))) }, // R(x) inner join S(y) on P[x, y] // λ x, y. [P[x, y]] × R(x) × S(y) @@ -184,140 +184,145 @@ impl Eval for Env<'_> { // + ¬(∑ x'. P[x', y] × R(x')) × Null(x) × S(y) // + ¬(∑ y'. P[x, y'] × S(y')) × Null(y) × R(x) Join { condition, left, right, kind } => { - let left_scopes = left.scope(schemas); - let right_scopes = right.scope(schemas); - let right_vars = &vars(lvl + left_scopes.len(), right_scopes); - let left_vars = &vars(lvl, left_scopes); - let body_lvl = lvl + scopes.len(); + let left_scope = left.scope(schemas); + let right_scope = right.scope(schemas); + let right_vars = &vars(lvl + left_scope.len(), right_scope); + let left_vars = &vars(lvl, left_scope); + let body_lvl = lvl + scope.len(); let body_env = Env(schemas, subst, body_lvl); - let left_body = UExpr::App(body_env.eval(*left.clone()), left_vars.clone()); - let right_body = UExpr::App(body_env.eval(*right.clone()), right_vars.clone()); + let left_body = UExpr::app(body_env.eval(*left.clone()), left_vars.clone()); + let right_body = UExpr::app(body_env.eval(*right.clone()), right_vars.clone()); let cond_subst = subst + &(left_vars + right_vars); let cond_env = Env(schemas, &cond_subst, body_lvl); - let matching = UExpr::Pred(cond_env.eval(condition.clone())) + let matching = UExpr::pred(cond_env.eval(condition.clone())) * left_body.clone() * right_body.clone(); let miss = |miss_left| { let missing = *if miss_left { left.clone() } else { right.clone() }; - let inner_scopes = missing.scope(schemas); - let inner_vars = vars(body_lvl, inner_scopes.clone()); - let inner_lvl = body_lvl + inner_scopes.len(); + let inner_scope = missing.scope(schemas); + let inner_vars = vars(body_lvl, inner_scope.clone()); + let inner_lvl = body_lvl + inner_scope.len(); let inner_cond_vars = if miss_left { &inner_vars + right_vars } else { left_vars + &inner_vars }; let inner_cond_subst = subst + &inner_cond_vars; - let inner_cond = UExpr::Pred( + let inner_cond = UExpr::pred( Env(schemas, &inner_cond_subst, inner_lvl).eval(condition.clone()), ); let missing = Env(schemas, subst, inner_lvl).eval(missing); - let inner_body = inner_cond * UExpr::App(missing, inner_vars); + let inner_body = inner_cond * UExpr::app(missing, inner_vars); let other_body = if miss_left { right_body.clone() } else { left_body.clone() }; if miss_left { left_vars } else { right_vars } .iter() - .map(|v| UExpr::Pred(Logic::is_null(v.clone()))) - .fold(other_body * !UExpr::sum(inner_scopes, inner_body), UExpr::mul) + .map(|v| UExpr::pred(v.clone().is_null())) + .fold(other_body * !UExpr::sum(inner_scope, inner_body), UExpr::mul) }; match kind { - JoinKind::Inner => Rel::lam(scopes, matching), - JoinKind::Left => Rel::lam(scopes, matching + miss(false)), - JoinKind::Right => Rel::lam(scopes, matching + miss(true)), - JoinKind::Full => Rel::lam(scopes, matching + miss(true) + miss(false)), + JoinKind::Inner => Lambda(scope, matching), + JoinKind::Left => Lambda(scope, matching + miss(false)), + JoinKind::Right => Lambda(scope, matching + miss(true)), + JoinKind::Full => Lambda(scope, matching + miss(true) + miss(false)), _ => unreachable!(), } }, - // R(x) correlate join S[x](y) + // R(x) correlated join S[x](y) // λx, y. R(x) × S[x](y) Correlate(left, right) => { - let left_scopes = left.scope(schemas); - let right_scopes = right.scope(schemas); - let right_vars = vars(lvl + left_scopes.len(), right_scopes); - let left_vars = vars(lvl, left_scopes); - let body_lvl = lvl + scopes.len(); + let left_scope = left.scope(schemas); + let right_scope = right.scope(schemas); + let right_vars = vars(lvl + left_scope.len(), right_scope); + let left_vars = vars(lvl, left_scope); + let body_lvl = lvl + scope.len(); let left = Env(schemas, subst, body_lvl).eval(*left); let right_subst = subst + &left_vars; let right = Env(schemas, &right_subst, body_lvl).eval(*right); - Rel::lam(scopes, UExpr::App(left, left_vars) * UExpr::App(right, right_vars)) + Lambda(scope, UExpr::app(left, left_vars) * UExpr::app(right, right_vars)) }, // R(x) union all S(y) // λx. R(x) + S(x) Union(sources) => { - let body_lvl = lvl + scopes.len(); - let vars = vars(lvl, scopes.clone()); + let body_lvl = lvl + scope.len(); + let vars = vars(lvl, scope.clone()); let sum = sources .into_iter() .map(|source| { - UExpr::App(Env(schemas, subst, body_lvl).eval(source), vars.clone()) + UExpr::app(Env(schemas, subst, body_lvl).eval(source), vars.clone()) }) .collect(); - Rel::lam(scopes, UExpr::Add(sum)) + Lambda(scope, Add(sum)) }, // R(x) intersect S(y) // λx. ‖R(x) × S(x)‖ Intersect(sources) => { - let body_lvl = lvl + scopes.len(); - let vars = vars(lvl, scopes.clone()); + let body_lvl = lvl + scope.len(); + let vars = vars(lvl, scope.clone()); let prod = sources .into_iter() .map(|source| { - UExpr::App(Env(schemas, subst, body_lvl).eval(source), vars.clone()) + UExpr::app(Env(schemas, subst, body_lvl).eval(source), vars.clone()) }) .collect(); - Rel::lam(scopes, UExpr::squash(UExpr::Mul(prod))) + Lambda(scope, UExpr::squash(Mul(prod))) }, // R(x) except S(y) // λx. ‖R(x) × ¬S(x)‖ Except(left, right) => { - let body_lvl = lvl + scopes.len(); - let vars = vars(lvl, scopes.clone()); + let body_lvl = lvl + scope.len(); + let vars = vars(lvl, scope.clone()); let left = Env(schemas, subst, body_lvl).eval(*left); let right = Env(schemas, subst, body_lvl).eval(*right); - Rel::lam( - scopes, - UExpr::squash(UExpr::App(left, vars.clone()) * !UExpr::App(right, vars)), + Lambda( + scope, + UExpr::squash(UExpr::app(left, vars.clone()) * !UExpr::app(right, vars)), ) }, // Distinct R(x) // λx. ‖R(x)‖ Distinct(source) => { - let source = Env(schemas, subst, lvl + scopes.len()).eval(*source); - Rel::lam(scopes.clone(), UExpr::squash(UExpr::App(source, vars(lvl, scopes)))) + let source = Env(schemas, subst, lvl + scope.len()).eval(*source); + Lambda(scope.clone(), UExpr::squash(UExpr::app(source, vars(lvl, scope)))) }, // Values ((a1, b1), (a2, b2), (a3, b3)) // λx, y. [x = a1] × [y = b1] + [x = a2] × [y = b2] + [x = a3] × [y = b3] Values { schema: _, content } => { - let vars = vars(lvl, scopes.clone()); - let env = Env(schemas, subst, lvl + scopes.len()); + let vars = vars(lvl, scope.clone()); + let env = Env(schemas, subst, lvl + scope.len()); let rows = content.into_iter().map(|row| { - let cols = - vars.iter().zip(row).map(|(v, e)| Pred(Logic::Eq(v.clone(), env.eval(e)))); - UExpr::Mul(cols.collect()) + let cols = vars + .iter() + .zip(row) + .map(|(v, e)| UExpr::pred(Logic::Eq(v.clone(), env.eval(e)))); + Mul(cols.collect()) }); - Rel::lam(scopes, UExpr::Add(rows.collect())) + Lambda(scope, Add(rows.collect())) }, // Agg1(f[x, y]), Agg2(g[x, y]) on R(x, y) // λa, b. [a = Agg1(λc. ∑x, y. [c = f[x, y]] × R(x, y))] // × [b = Agg2(λc. ∑x, y. [c = g[x, y]] × R(x, y))] Aggregate { columns, source } => { - let vars = vars(lvl, scopes.clone()); - let env = Env(schemas, subst, lvl + scopes.len()); + let vars = vars(lvl, scope.clone()); + let env = Env(schemas, subst, lvl + scope.len()); let cols = vars .into_iter() .zip(columns) - .map(|(v, agg)| Pred(Logic::Eq(v, env.eval((agg, *source.clone()))))); - Rel::lam(scopes, Mul(cols.collect())) + .map(|(v, agg)| UExpr::pred(Logic::Eq(v, env.eval((agg, *source.clone()))))); + Lambda(scope, Mul(cols.collect())) }, Sort { mut collation, offset, limit, source } => { // TODO: Better way to handle multiple sort columns. - if let Some((col, _, ord)) = collation.pop() { - let body = self.eval(Sort { collation, offset, limit, source }.into()); - Rel::HOp("sort".to_string(), vec![col.into(), ord.into()], body) + let vars = vars(lvl, scope.clone()); + let env = Env(schemas, subst, lvl + scope.len()); + let head = if let Some((col, _, ord)) = collation.pop() { + let body = env.eval(Sort { collation, offset, limit, source }.into()); + Head::HOp("sort".to_string(), vec![col.into(), ord.into()], body) } else { - let source = self.eval(source); - let offset = offset.map(|n| self.eval(n)).unwrap_or(0u32.into()); + let source = env.eval(source); + let offset = offset.map(|n| env.eval(n)).unwrap_or(0u32.into()); if let Some(count) = limit { - Rel::HOp("limit".to_string(), vec![self.eval(count), offset], source) + Head::HOp("limit".to_string(), vec![env.eval(count), offset], source) } else { - Rel::HOp("offset".to_string(), vec![offset], source) + Head::HOp("offset".to_string(), vec![offset], source) } - } + }; + Lambda(scope, Neu(Neutral(head, vars))) }, } } @@ -381,7 +386,17 @@ impl Eval<(AggCall, Relation), syntax::Expr> for Env<'_> { } else { source }; - syntax::Expr::HOp(agg.op, vec![], Box::new(self.eval(source)), agg.ty) + let Env(_, _, lvl) = self; + let Lambda(scope, body) = self.eval(source); + // TODO: Handle various agg calls. + match agg.op.as_str() { + "COUNT" => syntax::Expr::Agg(Aggr(agg.op, scope, body, Box::new(1u32.into()))), + _ if scope.len() == 1 => { + let var = vars(lvl, scope.clone())[0].clone(); + syntax::Expr::Agg(Aggr(agg.op, scope, body, var.into())) + }, + _ => syntax::Expr::HOp(agg.op, vec![], Lambda(scope, body).into(), agg.ty), + } } } @@ -436,46 +451,69 @@ impl Expr { impl Eval for Env<'_> { fn eval(self, source: Expr) -> syntax::Expr { use shared::Expr::*; + self.eval_logic(&source).map(|l| Log(l.into())).unwrap_or_else(|| { + match source { + Expr::Col { column, ty: _ } => self.1[column.0].clone(), + Expr::Op { op, args, ty } => { + let cast = matches!(op.as_str(), "+" | "-" | "*" | "/" if ty == DataType::Real) + || matches!(op.as_str(), ">" | "<" | ">=" | "<=" | "=" | "<>" | "!=" if args.iter().any(|e| e.ty() == DataType::Real)); + let args = + if cast { args.into_iter().map(Expr::into_real).collect() } else { args }; + Op(op, self.eval(args), ty) + }, + Expr::HOp { op, args, rel, ty } => HOp(op, self.eval(args), self.eval(*rel).into(), ty), + } + }) + } +} + +impl Env<'_> { + fn eval_logic(self, source: &Expr) -> Option { match source { - Expr::Col { column, ty: _ } => self.1[column.0].clone(), - Expr::Op { op, args, ty } => { - let cast = matches!(op.as_str(), "+" | "-" | "*" | "/" if ty == DataType::Real) - || matches!(op.as_str(), ">" | "<" | ">=" | "<=" | "=" if args.iter().any(|e| e.ty() == DataType::Real)); - let args = - if cast { args.into_iter().map(Expr::into_real).collect() } else { args }; - Op(op, self.eval(args), ty) + Expr::Op { op, args, ty: DataType::Boolean } => match op.to_uppercase().as_str() { + "TRUE" => Some(Logic::tt()), + "FALSE" => Some(Logic::ff()), + "<=>" | "IS NOT DISTINCT FROM" => { + Some(Logic::Eq(self.eval(args[0].clone()), self.eval(args[1].clone()))) + }, + "IS DISTINCT FROM" => { + Some(!Logic::Eq(self.eval(args[0].clone()), self.eval(args[1].clone()))) + }, + "IS NULL" => { + let e: syntax::Expr = self.eval(args[0].clone()); + Some(e.is_null()) + }, + "IS NOT NULL" => { + let e: syntax::Expr = self.eval(args[0].clone()); + Some(!e.is_null()) + }, + _ => None, + }, + Expr::HOp { op, args: _, rel, ty: DataType::Boolean } => match op.as_str() { + "EXISTS" => { + let Env(schemas, subst, lvl) = self; + let scope = rel.scope(schemas); + let rel = Env(schemas, subst, lvl + scope.len()).eval(*rel.clone()); + let vars = vars(lvl, scope.clone()); + Some(Logic::squash(UExpr::sum(scope, UExpr::app(rel, vars)))) + }, + _ => None, }, - Expr::HOp { ref op, .. } if op == "EXISTS" => Log(Box::new(self.eval(source))), - Expr::HOp { op, args, rel, ty } => HOp(op, self.eval(args), self.eval(rel), ty), + _ => None, } } } impl Eval for Env<'_> { fn eval(self, source: Expr) -> Logic { - match source.clone() { - Expr::Op { op, args, ty: DataType::Boolean } => match op.to_uppercase().as_str() { - "TRUE" => Logic::tt(), - "FALSE" => Logic::ff(), - "<=>" => Logic::Eq(self.eval(args[0].clone()), self.eval(args[1].clone())), - "=" | "<>" | "!=" if args.iter().any(|a| a.ty() == DataType::Real) => { - let args = args.into_iter().map(Expr::into_real).collect_vec(); - Logic::Bool(self.eval(Expr::Op { op, args, ty: DataType::Boolean })) - }, + assert_eq!(source.ty(), DataType::Boolean, "wrong type for predicate"); + self.eval_logic(&source).unwrap_or_else(|| match source.clone() { + Expr::Op { op, args, .. } => match op.to_uppercase().as_str() { "AND" => Logic::And(args.into_iter().map(|arg| self.eval(arg)).collect()), "OR" => Logic::Or(args.into_iter().map(|arg| self.eval(arg)).collect()), - // "NOT" => Logic::not(self.eval(args[0].clone())), - "IS NULL" => Logic::is_null(self.eval(args[0].clone())), - "IS NOT NULL" => !Logic::is_null(self.eval(args[0].clone())), - _ => Logic::Bool(self.eval(source)), - }, - Expr::Col { ty: DataType::Boolean, .. } => Logic::Bool(self.eval(source)), - Expr::HOp { op, args: _, rel, ty: DataType::Boolean } => match op.as_str() { - // "IN" => Logic::squash(UExpr::App(self.eval(*rel), self.eval(args).into())), - "EXISTS" => Logic::Exists(self.eval(*rel)), _ => Logic::Bool(self.eval(source)), }, - _ => panic!("wrong type for predicate"), - } + Expr::Col { .. } | Expr::HOp { .. } => Logic::Bool(self.eval(source)), + }) } } diff --git a/src/pipeline/shared.rs b/src/pipeline/shared.rs index 7104730..292e9f5 100644 --- a/src/pipeline/shared.rs +++ b/src/pipeline/shared.rs @@ -45,11 +45,33 @@ pub struct Schema { } #[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] -pub enum Expr { +pub enum Expr { Var(VL, DataType), - Log(Box>), - Op(String, Vec>, DataType), - HOp(String, Vec>, Box, DataType), + Log(Box>>), + Agg(A), + Op(String, Vec>, DataType), + HOp(String, Vec>, Box, DataType), +} + +pub trait Typed { + fn ty(&self) -> DataType; +} + +impl Typed for Expr { + fn ty(&self) -> DataType { + use Expr::*; + match self { + Var(_, ty) | Op(_, _, ty) | HOp(_, _, _, ty) => ty.clone(), + Log(_) => DataType::Boolean, + Agg(agg) => agg.ty(), + } + } +} + +impl Expr { + pub fn is_null(self) -> Logic { + Logic::Eq(Self::Op("NULL".to_string(), vec![], self.ty()), self) + } } #[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] @@ -62,19 +84,29 @@ impl Display for Lambda { } } +#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] +pub struct Sigma(pub Vector, pub U); + +impl Display for Sigma { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + writeln!(f, "∑ {:?} {{", self.0)?; + writeln!(indented(f).with_str("\t"), "{}", self.1)?; + writeln!(f, "}}") + } +} + #[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] -pub enum Logic { - Bool(Expr), - Eq(Expr, Expr), - Pred(String, Vec>), - Neg(Box>), - And(Vector>), - Or(Vector>), +pub enum Logic { + Bool(E), + Eq(E, E), + Pred(String, Vec), + Neg(Box>), + And(Vector>), + Or(Vector>), Squash(Box), - Exists(R), } -impl Logic { +impl Logic { pub fn tt() -> Self { Logic::And(vector![]) } @@ -83,17 +115,12 @@ impl Logic { Logic::Or(vector![]) } - pub fn is_null(expr: Expr) -> Self { - let ty = expr.ty(); - Self::Eq(expr, Expr::Op("NULL".to_string(), vec![], ty)) - } - - pub fn squash(uexpr: impl Into>) -> Self { - Self::Squash(uexpr.into()) + pub fn squash(u: impl Into>) -> Self { + Logic::Squash(u.into()) } } -impl Mul for Logic { +impl Mul for Logic { type Output = Self; fn mul(self, rhs: Self) -> Self::Output { @@ -107,7 +134,7 @@ impl Mul for Logic { } } -impl Add for Logic { +impl Add for Logic { type Output = Self; fn add(self, rhs: Self) -> Self::Output { @@ -121,7 +148,7 @@ impl Add for Logic { } } -impl Not for Logic { +impl Not for Logic { type Output = Self; fn not(self) -> Self::Output { @@ -129,7 +156,7 @@ impl Not for Logic { } } -impl Display for Logic { +impl Display for Logic { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { use Logic::*; match self { @@ -142,20 +169,14 @@ impl Display for Logic { Or(ls) if ls.is_empty() => write!(f, "false"), Or(ls) => write!(f, "({})", ls.iter().format(" ∨ ")), Squash(u) => write!(f, "{}", u), - Exists(rel) => write!(f, "∃({})", rel), } } } -impl Eval, Logic> for E -where - E: Eval, Expr> + Eval + Eval + Clone, - S: Clone, - T: Clone, - U: Clone, - V: Clone, +impl Eval, Logic> for Env +where Env: Eval + Eval + Clone { - fn eval(self, source: Logic) -> Logic { + fn eval(self, source: Logic) -> Logic { use Logic::*; match source { Bool(e) => Bool(self.eval(e)), @@ -165,32 +186,22 @@ where And(ls) => And(self.eval(ls)), Or(ls) => Or(self.eval(ls)), Squash(u) => Squash(self.eval(u)), - Exists(rel) => Exists(self.eval(rel)), } } } -impl Expr { - pub fn ty(&self) -> DataType { - use Expr::*; - match self { - Var(_, ty) | Op(_, _, ty) | HOp(_, _, _, ty) => ty.clone(), - Log(_) => DataType::Boolean, - } +impl Expr { + pub fn vars(level: usize, scope: Vector) -> Vector { + scope.into_iter().enumerate().map(|(l, ty)| Expr::Var(VL(level + l), ty)).collect() } } -impl Expr { - pub fn vars(level: usize, scopes: Vector) -> Vector> { - scopes.into_iter().enumerate().map(|(l, ty)| Expr::Var(VL(level + l), ty)).collect() - } -} - -impl Display for Expr { +impl Display for Expr { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { Expr::Var(v, _) => write!(f, "{}", v), Expr::Log(u) => write!(f, "‖{}‖", u), + Expr::Agg(agg) => write!(f, "{}", agg), Expr::Op(op, args, _) if args.is_empty() => write!(f, "\"{}\"", op), Expr::Op(op, args, _) => { write!(f, "{}({})", op, args.iter().join(", ")) @@ -200,70 +211,51 @@ impl Display for Expr { } } -impl From for Expr { +impl From for Expr { fn from(n: u32) -> Self { Expr::Op(n.to_string(), vec![], DataType::Integer) } } -impl From for Expr { +impl From for Expr { fn from(n: usize) -> Self { Expr::Op(n.to_string(), vec![], DataType::Integer) } } -impl From for Expr { +impl From for Expr { fn from(s: String) -> Self { Expr::Op(s, vec![], DataType::String) } } -impl Eval, Expr> for E -where - E: Eval<(VL, DataType), Expr> + Eval + Eval + Clone, - S: Clone, - T: Clone, - U: Clone, - V: Clone, +impl + Eval, Expr> for Env +where Env: Eval<(VL, DataType), Expr> + + Eval + + Eval + + Eval> + + Clone { - fn eval(self, source: Expr) -> Expr { + fn eval(self, source: Expr) -> Expr { use Expr::*; match source { Var(l, ty) => self.eval((l, ty)), - Log(l) => Log(Box::new(self.eval(*l))), + Log(l) => Log(self.eval(l)), + Agg(agg) => self.eval(agg), Op(f, args, ty) => Op(f, self.eval(args), ty), HOp(f, args, rel, ty) => HOp(f, self.clone().eval(args), self.eval(rel), ty), } } } -impl Eval, Neutral> for E -where E: Eval, Head> + Eval>, Vector>> + Clone -{ - fn eval(self, source: Neutral) -> Neutral { - let head = self.clone().eval(source.head); - let args = self.eval(source.args); - Neutral { head, args } - } -} - #[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] -pub struct Relation(pub Vector, pub Box); - -impl Display for Relation { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - writeln!(f, "λ {:?}", self.0)?; - writeln!(indented(f).with_str("\t"), "{}", self.1) - } -} - -#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] -pub enum Head { +pub enum Head { Var(VL), - HOp(String, Vec>, Box), + HOp(String, Vec, Box), } -impl Display for Head { +impl Display for Head { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { Head::Var(VL(l)) => write!(f, "#{}", l), @@ -274,33 +266,34 @@ impl Display for Head { } } -impl Eval, Head> for E -where E: Eval>, Vec>> + Eval, Box> + Clone +impl Eval, Head> for Env +where Env: Eval + Eval, Vec> + Clone { - fn eval(self, source: Head) -> Head { + fn eval(self, source: Head) -> Head { use Head::*; match source { Var(v) => Var(v), - HOp(op, args, rel) => HOp(op, self.clone().eval(args), self.eval(rel)), + HOp(op, args, rel) => HOp(op, self.clone().eval(args), self.eval(*rel).into()), } } } #[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] -pub struct Neutral { - pub head: Head, - pub args: Vector>, -} +pub struct Neutral(pub Head, pub Vector); -impl Neutral { - pub fn new(head: Head, args: Vector>) -> Self { - Neutral { head, args } +impl Display for Neutral { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + write!(f, "{}({})", self.0, self.1.iter().format(", ")) } } -impl Display for Neutral { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "{}({})", self.head, self.args.iter().format(", ")) +impl Eval, Neutral> for Env +where Env: Eval, Head> + Eval, Vector> + Clone +{ + fn eval(self, Neutral(head, args): Neutral) -> Neutral { + let head = self.clone().eval(head); + let args = self.eval(args); + Neutral(head, args) } } diff --git a/src/pipeline/stable.rs b/src/pipeline/stable.rs index fab2748..1a38594 100644 --- a/src/pipeline/stable.rs +++ b/src/pipeline/stable.rs @@ -1,43 +1,55 @@ use std::collections::BTreeMap; -use imbl::{HashSet, Vector}; +use imbl::{vector, HashSet, Vector}; use itertools::Itertools; use z3::ast::Ast; use z3::SatResult; use super::normal::Z3Env; -use super::shared::{Ctx, DataType, Eval, Lambda, Terms}; +use super::shared::{Ctx, DataType, Eval, Lambda, Sigma, Terms}; use crate::pipeline::normal; -use crate::pipeline::shared::{self, VL}; +use crate::pipeline::shared::{self, Typed, VL}; -pub type Expr<'c> = shared::Expr, UExpr<'c>>; -pub type Neutral<'c> = shared::Neutral, UExpr<'c>>; -pub type Logic<'c> = shared::Logic, UExpr<'c>>; +#[derive(Clone)] +pub struct Aggr<'c>( + pub String, + pub Vector, + pub Env<'c>, + pub normal::Inner, + pub normal::Expr, +); + +impl Typed for Aggr<'_> { + fn ty(&self) -> DataType { + self.4.ty() + } +} + +pub type Expr<'c> = shared::Expr, Relation<'c>, Aggr<'c>>; +pub type Neutral<'c> = shared::Neutral, Expr<'c>>; +pub type Logic<'c> = shared::Logic, Expr<'c>>; #[derive(Clone)] pub struct Relation<'c>(pub Vector, pub Env<'c>, pub normal::UExpr); pub type UExpr<'c> = Terms>; +// Env(subst: C -> stb::Expr D, z3: C -> z3::Expr): Eval (nom::Expr C) (stb::Expr D) #[derive(Clone)] -pub struct Env<'c>(pub Vector>>, pub usize, pub Z3Env<'c>); +pub struct Env<'c>(pub Vector>>, pub Z3Env<'c>); impl<'c> Env<'c> { pub fn append(&self, subst: Vector>>) -> Self { - Env(self.0.clone() + subst, self.1, self.2.clone()) + Env(self.0.clone() + subst, self.1.clone()) } pub fn extend(&self, base: usize, scope: Vector) -> Self { let vars = shared::Expr::vars(base, scope.clone()).into_iter().map(Some).collect(); - Env(self.0.clone() + vars, base + scope.len(), self.2.extend(&scope)) + Env(self.0.clone() + vars, self.1.extend(&scope)) } } #[derive(Clone)] -pub struct Term<'c> { - pub scope: Vector, - pub logic: Logic<'c>, - pub apps: Vector>, -} +pub struct Term<'c>(pub Vector, pub Env<'c>, pub normal::Inner); impl<'c> Eval<(VL, DataType), Expr<'c>> for &Env<'c> { fn eval(self, (VL(l), _): (VL, DataType)) -> Expr<'c> { @@ -51,39 +63,58 @@ impl<'c> Eval> for &Env<'c> { } } +impl<'c> Eval> for &Env<'c> { + fn eval(self, normal::Aggr(op, scope, i, e): normal::Aggr) -> Expr<'c> { + Expr::Agg(Aggr(op, scope, self.clone(), *i, *e)) + } +} + impl<'c> Eval> for &Env<'c> { fn eval(self, source: normal::UExpr) -> UExpr<'c> { - source.into_iter().filter_map(|term| self.eval(term)).collect() + source.into_iter().map(|term| self.eval(term)).collect() } } -fn var_elim<'c>( +// env : C -> stb::Expr D +// cong : [(Id, nom::Expr (C + S))] +// S', C + S -> stb::Expr (D + S') +pub fn min_subst<'c>( env: &Env<'c>, - vars: &[(u32, &normal::Expr)], + scope: Vector, + context: &Vector, cong: &[(u32, &normal::Expr)], ) -> (Vector, Vector>>) { - let groups = vars.iter().chain(cong).copied().into_group_map(); - let vars = vars - .iter() - .map(|&(g, e)| match e { - &shared::Expr::Var(v, ref ty) => (g, v, ty.clone()), - _ => unreachable!(), - }) - .collect_vec(); - - let Env(subst, lvl, _) = env; + let groups = cong.iter().copied().into_group_map(); + let Env(subst, _) = env; let level = subst.len(); - let bound = level..level + vars.len(); - let mut scope = Vector::new(); - let mut keys: HashSet<_> = vars.iter().map(|&(_, v, _)| v).collect(); + let bound = level..level + scope.len(); + let vars = bound.clone().map(VL); + let var_groups = vars.clone().map(|v| { + ( + v, + cong.iter() + .find(|&&(_, e)| e == &normal::Expr::Var(v, e.ty())) + .map(|(g, _)| groups.get(&g).unwrap()), + ) + }); + let mut new_scope = Vector::new(); + let mut keys: HashSet<_> = vars.clone().collect(); let mut deps_map = BTreeMap::new(); - let (exprs, mut var_subst) = vars - .into_iter() - .map(|(g, v, ty)| { - let group = groups.get(&g).unwrap(); + + fn root_deps(vars: &HashSet, deps_map: &BTreeMap>) -> HashSet { + let saturate = |var, deps: &BTreeMap<_, _>| { + deps.get(&var).map_or_else(|| HashSet::unit(var), |vars| root_deps(vars, deps)) + }; + HashSet::unions(vars.iter().map(|&v| saturate(v, deps_map))) + } + + let (exprs, mut var_subst) = var_groups + .zip(scope.clone()) + .map(|((v, es), ty)| { keys.remove(&v); - if let Some((_, deps, expr)) = group - .iter() + if let Some((_, deps, expr)) = es + .into_iter() + .flatten() .filter_map(|&expr| { let deps = expr.deps(&bound); let root_deps = root_deps(&deps, &deps_map); @@ -96,21 +127,14 @@ fn var_elim<'c>( (expr.clone(), None) } else { keys.insert(v); - let new_v = VL(lvl + scope.len()); + let new_v = VL(context.len() + new_scope.len()); log::info!("[key] {} ~> {}", v, new_v); - scope.push_back(ty.clone()); + new_scope.push_back(ty.clone()); (normal::Expr::Var(v, ty.clone()), Some(Expr::Var(new_v, ty))) } }) .unzip(); - - fn root_deps(vars: &HashSet, deps_map: &BTreeMap>) -> HashSet { - let saturate = |var, deps: &BTreeMap<_, _>| { - deps.get(&var).map_or_else(|| HashSet::unit(var), |vars| root_deps(vars, deps)) - }; - HashSet::unions(vars.iter().map(|&v| saturate(v, deps_map))) - } - + // Ensures v is mapped to some Expr fn prune<'c>( v: VL, deps_map: &mut BTreeMap>, @@ -128,75 +152,109 @@ fn var_elim<'c>( while let Some((&v, _)) = deps_map.first_key_value() { prune(v, &mut deps_map, &mut var_subst, &exprs, env); } - (scope, var_subst) + (new_scope, var_subst) } -impl<'c> Eval>> for &Env<'c> { - fn eval(self, source: normal::Term) -> Option> { - let Env(subst, lvl, z3_env) = self; - let z3_env = z3_env.extend(&source.scope); - let solver = &z3_env.0.solver; - let constraint = (&z3_env).eval(&source.logic); - let vars = shared::Expr::vars(subst.len(), source.scope.clone()); - let exprs = vars - .iter() - .chain(source.logic.exprs()) - .filter(|e| e.in_scope(subst.len() + source.scope.len())) - .collect_vec(); - let z3_asts = exprs.iter().map(|&e| (&z3_env).eval(e)).collect_vec(); - let z3_asts = z3_asts.iter().map(|e| e as &dyn Ast).collect_vec(); - solver.push(); - solver.assert(&constraint); - let handle = solver.get_context().handle(); - let checked = crossbeam::atomic::AtomicCell::new(false); - let interrupted = crossbeam::atomic::AtomicCell::new(false); - let (ids, res) = crossbeam::thread::scope(|s| { - let checked = &checked; - let interrupted = &interrupted; - let p = crossbeam::sync::Parker::new(); - let u = p.unparker().clone(); - s.spawn(move |_| { - p.park_timeout(Ctx::timeout()); - if !checked.load() { - handle.interrupt(); - interrupted.store(true); - } - }); - let (ids, res) = solver.get_implied_equalities(z3_asts.as_slice()); - checked.store(true); - u.unpark(); - if interrupted.load() { - (vec![], SatResult::Unknown) - } else { - (ids, res) - } - }) - .unwrap(); - solver.pop(1); - match res { - SatResult::Unsat => None, - SatResult::Unknown => { - let scope = source.scope; - let vars = &Expr::vars(*lvl, scope.clone()).into_iter().map(Some).collect(); - let env = &Env(subst + vars, lvl + scope.len(), z3_env); - let logic = env.eval(source.logic); - let apps = env.eval(source.apps); - Some(Term { scope, logic, apps }) +impl<'c> Eval> for &Env<'c> { + fn eval(self, Sigma(scope, inner): normal::Term) -> Term<'c> { + Term(scope, self.clone(), inner) + } +} + +pub type NormAgg<'c> = (Vector, Logic<'c>, Vector>, Expr<'c>); + +impl<'c> Expr<'c> { + pub fn split(self, aop: &str, context: &Vector) -> Vector> { + match self { + Expr::Op(op, args, _) if op == aop => { + args.into_iter().flat_map(|arg| arg.split(aop, context)).collect() }, - SatResult::Sat => { - let groups = ids.into_iter().zip(exprs).collect_vec(); - log::info!( - "Congruence groups: {}", - groups.iter().map(|(g, e)| format!("[{}, {}]", g, e)).join(", ") - ); - let (vars, cong) = groups.split_at(source.scope.len()); - let env = &Env(subst.clone(), *lvl, z3_env.clone()); - let (scope, ref new_subst) = var_elim(env, vars, cong); - let env = &Env(subst + new_subst, lvl + scope.len(), z3_env); - let logic = env.eval(source.logic); - let apps = env.eval(source.apps); - Some(Term { scope, logic, apps }) + Expr::Agg(Aggr(op, old_scope, env, i, e)) if op == aop => { + if let Some((scope, new_subst)) = + stablize(&env, old_scope.clone(), context, i.logic.clone()) + { + let Env(subst, z3_env) = env; + let env = &Env(subst + new_subst, z3_env.extend(&old_scope)); + let logic = env.eval(i.logic); + let apps = env.eval(i.apps); + env.eval(e) + .split(aop, &(context + &scope)) + .into_iter() + .map(|(scp, l, aps, e)| { + (&scope + &scp, Logic::And(vector![logic.clone(), l]), &apps + &aps, e) + }) + .collect() + } else { + vector![] + } }, + _ => vector![(vector![], Logic::tt(), vector![], self)], + } + } +} + +// Env: C -> stb::Expr D +// C + S ~> C + S' +pub fn stablize<'c>( + env: &Env<'c>, + scope: Vector, + context: &Vector, + logic: normal::Logic, +) -> Option<(Vector, Vector>>)> { + let Env(subst, z3_env) = env; + let z3_env = &z3_env.extend(&scope); + let solver = &z3_env.0.solver; + let constraint = z3_env.eval(&logic); + let vars = shared::Expr::vars(subst.len(), scope.clone()); + let exprs = vars + .iter() + .chain(logic.exprs()) + .filter(|e| e.in_scope(subst.len() + scope.len())) + .collect_vec(); + let z3_asts = exprs.iter().map(|&e| z3_env.eval(e)).collect_vec(); + let z3_asts = z3_asts.iter().map(|e| e as &dyn Ast).collect_vec(); + solver.push(); + solver.assert(&constraint); + let handle = solver.get_context().handle(); + let checked = crossbeam::atomic::AtomicCell::new(false); + let interrupted = crossbeam::atomic::AtomicCell::new(false); + let (ids, res) = crossbeam::thread::scope(|s| { + let checked = &checked; + let interrupted = &interrupted; + let p = crossbeam::sync::Parker::new(); + let u = p.unparker().clone(); + s.spawn(move |_| { + p.park_timeout(Ctx::timeout()); + if !checked.load() { + handle.interrupt(); + interrupted.store(true); + } + }); + let (ids, res) = solver.get_implied_equalities(z3_asts.as_slice()); + checked.store(true); + u.unpark(); + if interrupted.load() { + (vec![], SatResult::Unknown) + } else { + (ids, res) } + }) + .unwrap(); + solver.pop(1); + match res { + SatResult::Unsat => None, + SatResult::Unknown => { + let vars = Expr::vars(context.len(), scope.clone()).into_iter().map(Some).collect(); + Some((scope, vars)) + }, + SatResult::Sat => { + let groups = ids.into_iter().zip(exprs).collect_vec(); + log::info!( + "Congruence groups: {}", + groups.iter().map(|(g, e)| format!("[{}, {}]", g, e)).join(", ") + ); + let env = &Env(subst.clone(), z3_env.clone()); + Some(min_subst(env, scope, context, &groups)) + }, } } diff --git a/src/pipeline/syntax.rs b/src/pipeline/syntax.rs index 2261b9c..bc65b46 100644 --- a/src/pipeline/syntax.rs +++ b/src/pipeline/syntax.rs @@ -6,46 +6,30 @@ use indenter::indented; use itertools::Itertools; use UExpr::*; -use super::shared::VL; +use super::shared::{Lambda, Neutral, Typed}; use crate::pipeline::shared; use crate::pipeline::shared::DataType; -/// A relation in the U-semiring formalism is a function that maps a tuple to a U-semiring value. -/// It can be represented as a variable for an unknown relation, or encoded as a lambda function -/// when having the explict definition. -/// Here the lambda term uses a vector of data types to bind every components of the input tuple. -/// That is, each component is treated as a unique variable that might appear in the function body. -pub type Expr = shared::Expr; -#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] -pub struct Application(pub Relation, pub Vector); - -#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] -pub enum Relation { - Var(VL), - HOp(String, Vec, Box), - Lam(Vector, Box), -} +pub type Relation = Lambda; +pub type Expr = shared::Expr; +pub type Logic = shared::Logic; -pub type Logic = shared::Logic; +#[derive(Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)] +pub struct Aggr(pub String, pub Vector, pub UExpr, pub Box); -impl Relation { - pub fn lam(scopes: Vector, body: impl Into>) -> Relation { - Relation::Lam(scopes, body.into()) +impl Display for Aggr { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + let Aggr(name, scope, uexpr, expr) = self; + write!(f, "⨿{} {:?} {{", name, scope)?; + writeln!(indented(f).with_str("\t"), "{},", uexpr)?; + writeln!(indented(f).with_str("\t"), "{}", expr)?; + write!(f, "}}") } } -impl Display for Relation { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - match self { - Relation::Var(table) => write!(f, "#{}", table.0), - Relation::Lam(scopes, body) => { - writeln!(f, "(λ {:?}", scopes)?; - writeln!(indented(f).with_str("\t"), "{})", body) - }, - Relation::HOp(op, args, rel) => { - writeln!(f, "{}({}, {})", op, args.iter().join(", "), rel) - }, - } +impl Typed for Aggr { + fn ty(&self) -> DataType { + self.3.ty() } } @@ -65,10 +49,11 @@ pub enum UExpr { // Summation that ranges over tuples of certain schema Sum(Vector, Box), // Predicate that can be evaluated to 0 or 1 - Pred(Logic), - // Application of a relation with arguments. - // Here each argument are required to be a single variable. - App(Relation, Vector), + Pred(Box), + // Application of a lambda with arguments + App(Box, Vector), + // Neutral application + Neu(Neutral), } impl UExpr { @@ -80,13 +65,21 @@ impl UExpr { UExpr::Mul(vector![]) } - pub fn sum(scopes: impl Into>, body: impl Into>) -> Self { - Sum(scopes.into(), body.into()) + pub fn sum(scope: impl Into>, body: impl Into>) -> Self { + Sum(scope.into(), body.into()) } pub fn squash(body: impl Into>) -> Self { Squash(body.into()) } + + pub fn pred(l: Logic) -> Self { + Pred(l.into()) + } + + pub fn app(rel: impl Into>, args: Vector) -> Self { + App(rel.into(), args) + } } impl Display for UExpr { @@ -98,8 +91,8 @@ impl Display for UExpr { Mul(us) => write!(f, "({})", us.iter().format(" × ")), Squash(u) => write!(f, "‖{}‖", u), Not(u) => write!(f, "¬({})", u), - Sum(scopes, body) => { - writeln!(f, "∑ {:?} {{", scopes)?; + Sum(scope, body) => { + writeln!(f, "∑ {:?} {{", scope)?; writeln!(indented(f).with_str("\t"), "{}", body)?; write!(f, "}}") }, @@ -107,17 +100,13 @@ impl Display for UExpr { App(rel, args) => { write!(f, "{}({})", rel, args.iter().join(", ")) }, + Neu(Neutral(head, args)) => { + write!(f, "{}({})", head, args.iter().join(", ")) + }, } } } -impl Display for Application { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - let Application(rel, args) = self; - write!(f, "{}({})", rel, args.iter().join(", ")) - } -} - // The following overload the +, *, and ! operators for UExpr, so that we can construct an expression // in a natural way. diff --git a/src/pipeline/unify.rs b/src/pipeline/unify.rs index 7ba7666..7382623 100644 --- a/src/pipeline/unify.rs +++ b/src/pipeline/unify.rs @@ -1,41 +1,64 @@ use std::cell::RefCell; use std::collections::HashMap; use std::io::{Read, Write}; -use std::ops::Deref; use std::process::{Command, Stdio}; use std::rc::Rc; use imbl::Vector; use itertools::Itertools; use z3::ast::{Ast, Bool, Dynamic, Int}; -use z3::SatResult; -use super::normal::Term; -use super::shared::{self, Ctx}; -use crate::pipeline::normal::{Expr, HOpMap, RelHOpMap, Relation, UExpr, Z3Env}; +use super::normal::{Inner, Term}; +use super::shared::{Ctx, Lambda, Sigma}; +use crate::pipeline::normal::{Expr, UExpr, Z3Env}; use crate::pipeline::shared::{DataType, Eval}; pub trait Unify { - fn unify(self, t1: T, t2: T) -> bool; + fn unify(&self, t1: &T, t2: &T) -> bool; } #[derive(Clone)] pub struct UnifyEnv<'c>(pub Rc>, pub Vector>, pub Vector>); -impl<'c> Unify<&Relation> for &UnifyEnv<'c> { - fn unify(self, rel1: &Relation, rel2: &Relation) -> bool { - let (shared::Lambda(tys1, uexpr1), shared::Lambda(tys2, uexpr2)) = (rel1, rel2); - if tys1 != tys2 { +impl UnifyEnv<'_> { + fn envs(&self) -> (Z3Env, Z3Env) { + let UnifyEnv(ctx, subst1, subst2) = self; + let h_ops = Rc::new(RefCell::new(HashMap::new())); + let agg_ops = Rc::new(RefCell::new(HashMap::new())); + let rel_h_ops = Rc::new(RefCell::new(HashMap::new())); + let env1 = + Z3Env(ctx.clone(), subst1.clone(), h_ops.clone(), agg_ops.clone(), rel_h_ops.clone()); + let env2 = + Z3Env(ctx.clone(), subst2.clone(), h_ops.clone(), agg_ops.clone(), rel_h_ops.clone()); + (env1, env2) + } +} + +impl<'c, T> Unify> for UnifyEnv<'c> +where UnifyEnv<'c>: Unify +{ + fn unify(&self, t1: &Lambda, t2: &Lambda) -> bool { + let (Lambda(scp1, body1), Lambda(scp2, body2)) = (t1, t2); + if scp1 != scp2 { return false; } let UnifyEnv(ctx, subst1, subst2) = self; - let vars = &tys1.iter().map(|ty| ctx.var(ty, "v")).collect(); - UnifyEnv(ctx.clone(), subst1 + vars, subst2 + vars).unify(uexpr1, uexpr2) + let vars = &scp1.iter().map(|ty| ctx.var(ty, "v")).collect(); + let env = UnifyEnv(ctx.clone(), subst1 + vars, subst2 + vars); + env.unify(body1, body2) } } -impl<'c> Unify<&UExpr> for &UnifyEnv<'c> { - fn unify(self, u1: &UExpr, u2: &UExpr) -> bool { +impl<'c, A, B> Unify<(A, B)> for UnifyEnv<'c> +where UnifyEnv<'c>: Unify + Unify +{ + fn unify(&self, (a1, b1): &(A, B), (a2, b2): &(A, B)) -> bool { + self.unify(a1, a2) && self.unify(b1, b2) + } +} + +impl<'c> Unify for UnifyEnv<'c> { + fn unify(&self, u1: &UExpr, u2: &UExpr) -> bool { let mut terms2 = u2.0.clone(); u1.0.len() == u2.0.len() && u1.iter().all(|t1| { @@ -45,62 +68,70 @@ impl<'c> Unify<&UExpr> for &UnifyEnv<'c> { } } -impl<'c> Unify<&Expr> for &UnifyEnv<'c> { - fn unify(self, t1: &Expr, t2: &Expr) -> bool { - let UnifyEnv(ctx, subst1, subst2) = self; - let h_ops = Rc::new(RefCell::new(HashMap::new())); - let rel_h_ops = Rc::new(RefCell::new(HashMap::new())); - let env1 = &Z3Env(ctx.clone(), subst1.clone(), h_ops.clone(), rel_h_ops.clone()); - let env2 = &Z3Env(ctx.clone(), subst2.clone(), h_ops.clone(), rel_h_ops.clone()); - let e1 = env1.eval(t1); - let e2 = env2.eval(t2); - let h_ops_equiv = - extract_equiv(ctx.clone(), h_ops.borrow().deref(), rel_h_ops.borrow().deref()); - ctx.solver.check_assumptions(&[h_ops_equiv, e1._eq(&e2).not()]) == SatResult::Unsat - } -} - -impl<'c> Unify<&Vec> for &UnifyEnv<'c> { - fn unify(self, ts1: &Vec, ts2: &Vec) -> bool { - ts1.len() == ts2.len() && ts1.iter().zip(ts2).all(|(t1, t2)| self.unify(t1, t2)) +impl<'c> Unify> for UnifyEnv<'c> { + fn unify(&self, es1: &Vec, es2: &Vec) -> bool { + es1.len() == es2.len() && { + let (ref env1, ref env2) = self.envs(); + let expr_eqs = + es1.iter().zip(es2).map(|(e1, e2)| env1.eval(e1)._eq(&env2.eval(e2))).collect_vec(); + let eq = Bool::and(self.0.z3_ctx(), &expr_eqs.iter().collect_vec()); + let h_ops_eq = env1.extract_equiv(); + smt(&self.0.solver, h_ops_eq.implies(&eq)) + } } } -fn extract_equiv<'c>(ctx: Rc>, h_ops: &HOpMap<'c>, rel_h_ops: &RelHOpMap<'c>) -> Bool<'c> { - let expr_eqs = h_ops - .iter() - .tuple_combinations() - .filter_map(|(((op1, args1, rel1, env1), v1), ((op2, args2, rel2, env2), v2))| { - let env = &UnifyEnv(ctx.clone(), env1.clone(), env2.clone()); - (op1 == op2 && env.unify(args1, args2) && env.unify(rel1, rel2)).then(|| v1._eq(v2)) - }) - .collect_vec(); - let rel_eqs = rel_h_ops - .iter() - .tuple_combinations() - .filter_map( - |( - ((op1, args1, rel1, env1, sq1), (n1, dom1)), - ((op2, args2, rel2, env2, sq2), (n2, dom2)), - )| { - let env = UnifyEnv(ctx.clone(), env1.clone(), env2.clone()); - (op1 == op2 - && sq1 == sq2 && dom1 == dom2 - && env.unify(args1, args2) - && env.unify(rel1, rel2)) - .then(|| { - let vars = dom1.iter().map(|ty| ctx.var(ty, "t")).collect_vec(); - let vars = vars.iter().collect_vec(); - let target = if *sq1 { DataType::Boolean } else { DataType::Integer }; - let l = &ctx.app(n1, &vars, &target, false); - let r = &ctx.app(n2, &vars, &target, false); - let vars = vars.iter().map(|&v| v as &dyn Ast).collect_vec(); - z3::ast::forall_const(ctx.z3_ctx(), &vars, &[], &l._eq(r)) - }) - }, +impl Z3Env<'_> { + pub fn extract_equiv(&self) -> Bool { + let Z3Env(ctx, _, h_ops, agg_ops, rel_h_ops) = self; + let (h_ops, agg_ops, rel_h_ops) = + (&*h_ops.borrow(), &*agg_ops.borrow(), &*rel_h_ops.borrow()); + let expr_eqs = h_ops + .iter() + .tuple_combinations() + .filter_map(|(((op1, args1, rel1, env1), v1), ((op2, args2, rel2, env2), v2))| { + let env = &UnifyEnv(ctx.clone(), env1.clone(), env2.clone()); + (op1 == op2 && env.unify(args1, args2) && env.unify(rel1, rel2)).then(|| v1._eq(v2)) + }) + .collect_vec(); + let agg_eqs = agg_ops + .iter() + .tuple_combinations() + .filter_map(|(((op1, lam1, env1), v1), ((op2, lam2, env2), v2))| { + let env = &UnifyEnv(ctx.clone(), env1.clone(), env2.clone()); + (op1 == op2 && env.unify(lam1, lam2)).then(|| v1._eq(v2)) + }) + .collect_vec(); + let rel_eqs = rel_h_ops + .iter() + .tuple_combinations() + .filter_map( + |( + ((op1, args1, rel1, env1, sq1), (n1, dom1)), + ((op2, args2, rel2, env2, sq2), (n2, dom2)), + )| { + let env = UnifyEnv(ctx.clone(), env1.clone(), env2.clone()); + (op1 == op2 + && sq1 == sq2 && dom1 == dom2 + && env.unify(args1, args2) + && env.unify(rel1, rel2)) + .then(|| { + let vars = dom1.iter().map(|ty| ctx.var(ty, "t")).collect_vec(); + let vars = vars.iter().collect_vec(); + let target = if *sq1 { DataType::Boolean } else { DataType::Integer }; + let l = &ctx.app(n1, &vars, &target, false); + let r = &ctx.app(n2, &vars, &target, false); + let vars = vars.iter().map(|&v| v as &dyn Ast).collect_vec(); + z3::ast::forall_const(ctx.z3_ctx(), &vars, &[], &l._eq(r)) + }) + }, + ) + .collect_vec(); + Bool::and( + ctx.z3_ctx(), + &expr_eqs.iter().chain(agg_eqs.iter()).chain(rel_eqs.iter()).collect_vec(), ) - .collect_vec(); - Bool::and(ctx.z3_ctx(), &expr_eqs.iter().chain(rel_eqs.iter()).collect_vec()) + } } fn perm_equiv(v1: &Vector, v2: &Vector) -> bool { @@ -120,9 +151,9 @@ where { use itertools::Either; let sort_perm = permutation::sort(types.as_slice()); - let sorted_scopes = sort_perm.apply_slice(types.as_slice()); + let sorted_scope = sort_perm.apply_slice(types.as_slice()); let sorted_vars = sort_perm.apply_slice(vars.as_slice()); - let groups = sorted_scopes.iter().group_by(|a| *a); + let groups = sorted_scope.iter().group_by(|a| *a); let group_lengths = if types.is_empty() { Either::Left(std::iter::once(0)) } else { @@ -144,41 +175,41 @@ where }) } -impl<'c> Unify<&Term> for &UnifyEnv<'c> { - fn unify(self, t1: &Term, t2: &Term) -> bool { - if !perm_equiv(&t1.scope, &t2.scope) { +impl<'c> Unify for UnifyEnv<'c> { + fn unify(&self, Sigma(s1, t1): &Term, Sigma(s2, t2): &Term) -> bool { + if !perm_equiv(&s1, &s2) { return false; } log::info!("Unifying\n{}\n{}", t1, t2); let UnifyEnv(ctx, subst1, subst2) = self; - let z3_ctx = ctx.z3_ctx(); - let vars1 = t1.scope.iter().map(|ty| ctx.var(ty, "v")).collect(); + let vars1 = s1.iter().map(|ty| ctx.var(ty, "v")).collect(); let subst1 = subst1 + &vars1; - perms(t1.scope.iter().cloned().collect(), vars1.into_iter().collect()).take(24).any( - |vars2| { - assert_eq!(vars2.len(), t2.scope.len()); - log::info!("Permutation: {:?}", vars2); - let subst2 = subst2 + &vars2.into(); - let h_ops = Rc::new(RefCell::new(HashMap::new())); - let rel_h_ops = Rc::new(RefCell::new(HashMap::new())); - let env1 = &Z3Env(ctx.clone(), subst1.clone(), h_ops.clone(), rel_h_ops.clone()); - let env2 = &Z3Env(ctx.clone(), subst2.clone(), h_ops.clone(), rel_h_ops.clone()); - let (logic1, apps1): (_, Int<'c>) = (env1.eval(&t1.logic), env1.eval(&t1.apps)); - let (logic2, apps2) = (env2.eval(&t2.logic), env2.eval(&t2.apps)); - let equiv = logic1 - .ite(&apps1, &Int::from_i64(z3_ctx, 0)) - ._eq(&logic2.ite(&apps2, &Int::from_i64(z3_ctx, 0))); - let solver = &ctx.solver; - solver.push(); - solver.assert(&Bool::or(z3_ctx, &[&logic1, &logic2])); - let h_ops_equiv = - extract_equiv(ctx.clone(), h_ops.borrow().deref(), rel_h_ops.borrow().deref()); - solver.pop(1); - log::info!("{}", equiv); - log::info!("{}", h_ops_equiv); - smt(solver, h_ops_equiv.implies(&equiv)) - }, - ) + perms(s1.iter().cloned().collect(), vars1.into_iter().collect()).take(24).any(|vars2| { + assert_eq!(vars2.len(), s2.len()); + log::info!("Permutation: {:?}", vars2); + UnifyEnv(ctx.clone(), subst1.clone(), subst2 + &vars2.into()).unify(t1, t2) + }) + } +} + +impl Unify for UnifyEnv<'_> { + fn unify(&self, t1: &Inner, t2: &Inner) -> bool { + let UnifyEnv(ctx, _, _) = self; + let (ref env1, ref env2) = self.envs(); + let z3_ctx = ctx.z3_ctx(); + let (logic1, apps1) = (env1.eval(&t1.logic), env1.eval(&t1.apps)); + let (logic2, apps2) = (env2.eval(&t2.logic), env2.eval(&t2.apps)); + let equiv = logic1 + .ite(&apps1, &Int::from_i64(z3_ctx, 0)) + ._eq(&logic2.ite(&apps2, &Int::from_i64(z3_ctx, 0))); + let solver = &ctx.solver; + solver.push(); + solver.assert(&Bool::or(z3_ctx, &[&logic1, &logic2])); + let h_ops_equiv = env1.extract_equiv(); + solver.pop(1); + log::info!("{}", equiv); + log::info!("{}", h_ops_equiv); + smt(solver, h_ops_equiv.implies(&equiv)) } } @@ -219,7 +250,8 @@ pub(crate) fn smt<'c>(solver: &'c z3::Solver, pred: Bool<'c>) -> bool { drop(z3_in); let mut result = String::new(); z3_out.read_to_string(&mut result).expect("Failed to read stdout."); - let provable = dbg!(&result).starts_with("unsat\n"); + log::info!("Z3 result: {}", result); + let provable = result.starts_with("unsat\n"); res.fetch_or(provable); if !result.starts_with("unknown\n") { u1.unpark(); @@ -231,7 +263,8 @@ pub(crate) fn smt<'c>(solver: &'c z3::Solver, pred: Bool<'c>) -> bool { drop(cvc5_in); let mut result = String::new(); cvc5_out.read_to_string(&mut result).expect("Failed to read stdout."); - let provable = dbg!(&result).ends_with("unsat\n"); + log::info!("CVC5 result: {}", result); + let provable = result.ends_with("unsat\n"); res.fetch_or(provable); if !result.ends_with("unknown\n") { u2.unpark(); From 6bfdd14c86085203666df8ed831f81ea3697b47d Mon Sep 17 00:00:00 2001 From: Shuxian Wang Date: Tue, 11 Jul 2023 20:49:19 -0700 Subject: [PATCH 05/11] Update --- .github/workflows/build.yml | 2 +- Cargo.lock | 102 +++++++++++++++++-------------- flake.lock | 36 +++++------ flake.nix | 3 +- src/main.rs | 2 + src/pipeline.rs | 2 + src/pipeline/normal.rs | 107 ++++++++++++++++++-------------- src/pipeline/null.rs | 4 +- src/pipeline/relation.rs | 118 ++++++++++++++++++++---------------- src/pipeline/shared.rs | 1 + src/pipeline/unify.rs | 4 +- 11 files changed, 215 insertions(+), 166 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index efb5041..6020300 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v20 + - uses: cachix/install-nix-action@v22 with: nix_path: nixpkgs=channel:nixos-unstable - uses: cachix/cachix-action@v12 diff --git a/Cargo.lock b/Cargo.lock index bf66588..e3909e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "aho-corasick" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -42,9 +42,9 @@ checksum = "230c5f1ca6a325a32553f8640d31ac9b49f2411e901e427570154868b46da4f7" [[package]] name = "bindgen" -version = "0.60.1" +version = "0.64.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "062dddbc1ba4aca46de6338e2bf87771414c335f7b2f2036e8f3e9befebf88e6" +checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" dependencies = [ "bitflags", "cexpr", @@ -57,6 +57,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", + "syn 1.0.109", ] [[package]] @@ -157,9 +158,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.14" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", "cfg-if", @@ -180,9 +181,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", ] @@ -320,9 +321,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" [[package]] name = "lazy_static" @@ -338,9 +339,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.142" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libloading" @@ -354,12 +355,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "memchr" @@ -369,9 +367,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ "autocfg", ] @@ -394,9 +392,9 @@ dependencies = [ [[package]] name = "num" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" +checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" dependencies = [ "num-bigint", "num-complex", @@ -470,9 +468,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" +checksum = "b4b27ab7be369122c218afc2079489cdcb4b517c0a3fc386ff11e1fedfcc2b35" [[package]] name = "peeking_take_while" @@ -488,18 +486,18 @@ checksum = "d9978962f8a4b158e97447a6d09d2d75e206d2994eff056c894019f362b27142" [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" dependencies = [ "proc-macro2", ] @@ -521,9 +519,21 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.1" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" +checksum = "83d3daa6976cffb758ec878f108ba0e062a45b2d6ca3a2cca965338855476caf" dependencies = [ "aho-corasick", "memchr", @@ -532,9 +542,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.1" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "rustc-hash" @@ -544,9 +554,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" [[package]] name = "same-file" @@ -565,9 +575,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.160" +version = "1.0.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" +checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" dependencies = [ "serde_derive", ] @@ -604,20 +614,20 @@ checksum = "794e44574226fc701e3be5c651feb7939038fc67fb73f6f4dd5c4ba90fd3be70" [[package]] name = "serde_derive" -version = "1.0.160" +version = "1.0.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" +checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.25", ] [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "b5062a995d481b2308b6064e9af76011f2921c35f97b0468811ed9f6cd91dfed" dependencies = [ "itoa", "ryu", @@ -643,9 +653,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.15" +version = "2.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2" dependencies = [ "proc-macro2", "quote", @@ -663,9 +673,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" [[package]] name = "version_check" @@ -717,7 +727,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "z3" version = "0.11.2" -source = "git+https://github.com/wsx-ucb/z3.rs?branch=add-binding#f9766a713a8da6a7f6c3e21ff5179a55b0527501" +source = "git+https://github.com/wsx-ucb/z3.rs?branch=add-binding#b667c153578d61347b7607d672f84a65a17af5b2" dependencies = [ "log", "z3-sys", @@ -726,7 +736,7 @@ dependencies = [ [[package]] name = "z3-sys" version = "0.7.1" -source = "git+https://github.com/wsx-ucb/z3.rs?branch=add-binding#f9766a713a8da6a7f6c3e21ff5179a55b0527501" +source = "git+https://github.com/wsx-ucb/z3.rs?branch=add-binding#b667c153578d61347b7607d672f84a65a17af5b2" dependencies = [ "bindgen", ] diff --git a/flake.lock b/flake.lock index e2c1092..583c1d9 100644 --- a/flake.lock +++ b/flake.lock @@ -12,11 +12,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1681680516, - "narHash": "sha256-EB8Adaeg4zgcYDJn9sR6UMjN/OHdIiMMK19+3LmmXQY=", + "lastModified": 1688772518, + "narHash": "sha256-ol7gZxwvgLnxNSZwFTDJJ49xVY5teaSvF7lzlo3YQfM=", "owner": "ipetkov", "repo": "crane", - "rev": "54b63c8eae4c50172cb50b612946ff1d2bc1c75c", + "rev": "8b08e96c9af8c6e3a2b69af5a7fa168750fcf88e", "type": "github" }, "original": { @@ -33,11 +33,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1682230876, - "narHash": "sha256-vCnd1pZRQKCdNvivQBD7WzaOlU1GcN91OCAz1rnoe5M=", + "lastModified": 1689143068, + "narHash": "sha256-e4sFP90ZPkBd+ADnCb0Mohc1oAuUQ4DbJytMyY50GoM=", "owner": "nix-community", "repo": "fenix", - "rev": "378f052d9f1cd90060ec4329f81782fee80490a4", + "rev": "44afdb4711d40da215349d2bdf6dabb1e445d50d", "type": "github" }, "original": { @@ -67,11 +67,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", "owner": "numtide", "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", "type": "github" }, "original": { @@ -82,11 +82,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1684464849, - "narHash": "sha256-f8th/GWE9M2hePTMZc0YyFboigt9AG/ioEcyHcdFK2I=", + "lastModified": 1689078114, + "narHash": "sha256-osG8BrX5RpKJ7wH+vI6auOU+ctvNOblT4XXCgknK47c=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b969a89c3e84a121c9b3af2e4ef277cd822b988a", + "rev": "b6cc7ff8fee93789bc871a267ab876c3fca042cb", "type": "github" }, "original": { @@ -107,11 +107,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1682163822, - "narHash": "sha256-u7vaRlI6rYiutytoTk8lyOtNKO/rz5Q63Z6S6QzYCtU=", + "lastModified": 1689076917, + "narHash": "sha256-qVWiZWmnEh5SLaMGC9SrKje3A0imueA5esCrqLJi1WY=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "2feabc4dc462644287372922928110eea4c60ca7", + "rev": "75ac37f317269798da87d42738d79cade3a28ab9", "type": "github" }, "original": { @@ -133,11 +133,11 @@ ] }, "locked": { - "lastModified": 1680488274, - "narHash": "sha256-0vYMrZDdokVmPQQXtFpnqA2wEgCCUXf5a3dDuDVshn0=", + "lastModified": 1688351637, + "narHash": "sha256-CLTufJ29VxNOIZ8UTg0lepsn3X03AmopmaLTTeHDCL4=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "7ec2ff598a172c6e8584457167575b3a1a5d80d8", + "rev": "f9b92316727af9e6c7fee4a761242f7f46880329", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 451a481..b9c35f5 100644 --- a/flake.nix +++ b/flake.nix @@ -23,13 +23,14 @@ craneLib = crane.lib.${system}.overrideToolchain fenix.packages.${system}.complete.toolchain; packageDef = with pkgs; { src = craneLib.cleanCargoSource ./.; - buildInputs = with pkgs; [ z3_4_11 cvc5 ]; + buildInputs = with pkgs; [ z3_4_12 cvc5 ]; nativeBuildInputs = with pkgs; [ rustPlatform.bindgenHook makeWrapper ] ++ lib.optionals stdenv.isDarwin [ libiconv ]; }; cargoArtifacts = craneLib.buildDepsOnly packageDef; cosette-prover = craneLib.buildPackage (packageDef // { inherit cargoArtifacts; + doNotLinkInheritedArtifacts = true; postInstall = with pkgs; "wrapProgram $out/bin/cosette-prover --set PATH ${lib.makeBinPath [ cvc5 z3_4_11 ]}"; }); in { diff --git a/src/main.rs b/src/main.rs index 4a661fc..9e38c2f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,6 @@ #![feature(slice_as_chunks)] +#![feature(if_let_guard)] +#![feature(let_chains)] use std::any::Any; use std::collections::BTreeMap; use std::fs::File; diff --git a/src/pipeline.rs b/src/pipeline.rs index fe73f71..26309a6 100644 --- a/src/pipeline.rs +++ b/src/pipeline.rs @@ -25,6 +25,7 @@ pub mod unify; pub struct Input { schemas: Vec, queries: (relation::Relation, relation::Relation), + #[serde(default)] help: (String, String), } @@ -34,6 +35,7 @@ pub fn unify(Input { schemas, queries: (rel1, rel2), help }: Input) -> bool { log::info!("Schemas:\n{:?}", schemas); log::info!("Input:\n{}\n{}", help.0, help.1); if rel1 == rel2 { + println!("Trivially true!"); return true; } let rel1 = env.eval(rel1); diff --git a/src/pipeline/normal.rs b/src/pipeline/normal.rs index 7e36f12..85a5faa 100644 --- a/src/pipeline/normal.rs +++ b/src/pipeline/normal.rs @@ -15,6 +15,7 @@ use z3::{Config, Context, Solver}; use super::shared::{Ctx, Lambda, Sigma, Typed}; use super::stable::{self, stablize}; use super::unify::{Unify, UnifyEnv}; +use crate::pipeline::relation::num_op; use crate::pipeline::shared::{DataType, Eval, Neutral as Neut, Terms, VL}; use crate::pipeline::{partial, shared}; @@ -118,7 +119,10 @@ impl Expr { fn exprs(&self) -> Vector<&Expr> { match self { Expr::Log(l) => l.exprs(), - Expr::Op(op, es, ty) if op == "=" && es.len() == 2 && ty == &DataType::Boolean => { + Expr::Op(op, es, ty) + if matches!(op.as_str(), "=" | "EQ") + && es.len() == 2 && ty == &DataType::Boolean => + { es.iter().collect() }, Expr::Op(_, es, _) | Expr::HOp(_, es, _, _) => { @@ -562,57 +566,72 @@ impl<'c> Eval<&Expr, Dynamic<'c>> for &Z3Env<'c> { match source { Expr::Var(VL(l), _) => subst[*l].clone(), Expr::Log(l) => ctx.bool_some(self.eval(l.as_ref())), - Expr::Op(op, args, ty) if args.is_empty() => parse(ctx.as_ref(), op, ty) - .unwrap_or_else(|_| ctx.app(&format!("f!{}", op), &[], ty, true)), + Expr::Op(op, args, ty) if args.is_empty() && let Ok(exp) = parse(ctx.as_ref(), op, ty) => exp, Expr::Op(op, expr_args, ty) => { let args = expr_args.iter().map(|a| self.eval(a)).collect_vec(); let args = args.iter().collect_vec(); match op.as_str() { - num_op @ ("+" | "-" | "*" | "/" | "%" /*| "POWER" */) if ty == &Integer => { - match num_op { - "+" => ctx.int_add_v(&args), - "-" => ctx.int_sub_v(&args), - "*" => ctx.int_mul_v(&args), - "/" => ctx.int_div(args[0], args[1]), - "%" => ctx.int_modulo(args[0], args[1]), - // "POWER" => ctx.int_power(args[0], args[1]), - _ => unreachable!(), - } + op if num_op(op) && ty == &Integer => match op { + "+" | "PLUS" | "UNARY PLUS" => ctx.int_add_v(&args), + "-" | "MINUS" | "UNARY MINUS" => ctx.int_sub_v(&args), + "*" | "MULT" => ctx.int_mul_v(&args), + "/" | "DIV" => ctx.int_div(args[0], args[1]), + "%" => ctx.int_modulo(args[0], args[1]), + // "POWER" => ctx.int_power(args[0], args[1]), + _ => unreachable!(), }, - num_op @ ("+" | "-" | "*" | "/" /*| "POWER" */) if ty == &Real => match num_op { - "+" => ctx.real_add_v(&args), - "-" => ctx.real_sub_v(&args), - "*" => ctx.real_mul_v(&args), - "/" => ctx.real_div(args[0], args[1]), + op if num_op(op) && ty == &Real => match op { + "+" | "PLUS" | "UNARY PLUS" => ctx.real_add_v(&args), + "-" | "MINUS" | "UNARY MINUS" => ctx.real_sub_v(&args), + "*" | "MULT" => ctx.real_mul_v(&args), + "/" | "DIV" => ctx.real_div(args[0], args[1]), // "POWER" => ctx.real_power(args[0], args[1]), _ => unreachable!(), }, - cmp @ (">" | "<" | ">=" | "<=") if expr_args[0].ty() == Integer => match cmp { - ">" => ctx.int_gt(args[0], args[1]), - "<" => ctx.int_lt(args[0], args[1]), - ">=" => ctx.int_ge(args[0], args[1]), - "<=" => ctx.int_le(args[0], args[1]), - _ => unreachable!(), + cmp @ (">" | "GT" | "<" | "LT" | ">=" | "GE" | "<=" | "LE") + if expr_args[0].ty() == Integer => + { + match cmp { + ">" | "GT" => ctx.int_gt(args[0], args[1]), + "<" | "LT" => ctx.int_lt(args[0], args[1]), + ">=" | "GE" => ctx.int_ge(args[0], args[1]), + "<=" | "LE" => ctx.int_le(args[0], args[1]), + _ => unreachable!(), + } }, - cmp @ (">" | "<" | ">=" | "<=") if expr_args[0].ty() == Real => match cmp { - ">" => ctx.real_gt(args[0], args[1]), - "<" => ctx.real_lt(args[0], args[1]), - ">=" => ctx.real_ge(args[0], args[1]), - "<=" => ctx.real_le(args[0], args[1]), - _ => unreachable!(), + cmp @ (">" | "GT" | "<" | "LT" | ">=" | "GE" | "<=" | "LE") + if expr_args[0].ty() == Real => + { + match cmp { + ">" | "GT" => ctx.real_gt(args[0], args[1]), + "<" | "LT" => ctx.real_lt(args[0], args[1]), + ">=" | "GE" => ctx.real_ge(args[0], args[1]), + "<=" | "LE" => ctx.real_le(args[0], args[1]), + _ => unreachable!(), + } }, - cmp @ ("=" | "<>" | "!=") => { + cmp @ ("=" | "EQ" | "<>" | "!=" | "NE") => { let (a1, a2) = (args[0], args[1]); - assert_eq!(a1.get_sort(), a2.get_sort(), "{} and {} have different types.", expr_args[0], expr_args[1]); + assert_eq!( + a1.get_sort(), + a2.get_sort(), + "{} and {} have different types.", + expr_args[0], + expr_args[1] + ); let eq = match expr_args[0].ty() { - Integer => ctx.int__eq(a1, a2), - Real => ctx.real__eq(a1, a2), - Boolean => ctx.bool__eq(a1, a2), - String => ctx.string__eq(a1, a2), - Custom(_) => todo!("Cannot compare between arbitrary types yet."), - }; - if cmp == "=" { eq } else { ctx.bool_not(&eq) } - } + Integer => ctx.int__eq(a1, a2), + Real => ctx.real__eq(a1, a2), + Boolean => ctx.bool__eq(a1, a2), + String => ctx.string__eq(a1, a2), + Custom(_) => todo!("Cannot compare between arbitrary types yet."), + }; + if cmp == "=" || cmp == "EQ" { + eq + } else { + ctx.bool_not(&eq) + } + }, "NOT" if args.len() == 1 => ctx.bool_not(args[0]), "AND" => ctx.bool_and_v(&args), "OR" => ctx.bool_or_v(&args), @@ -622,19 +641,19 @@ impl<'c> Eval<&Expr, Dynamic<'c>> for &Z3Env<'c> { ctx.bool_is_true(cond).ite(body, &rem) }) }, - "CAST" if ty == &expr_args[0].ty() => { - args[0].clone() - }, + "CAST" if ty == &expr_args[0].ty() => args[0].clone(), "CAST" if ty == &Real && expr_args[0].ty() == Integer => { ctx.int_to_real(args[0]) }, + "CAST" if let Expr::Op(op, args, _) = &expr_args[0] && args.is_empty() + && let Ok(exp) = parse(ctx.as_ref(), op, ty) => exp, "COUNT" | "SUM" | "MIN" | "MAX" => { if args.len() == 1 { args[0].clone() } else { ctx.app(&format!("f{}!{}", args.len(), op), &args, ty, true) } - } + }, op => ctx.app(&format!("f!{}", op), &args, ty, true), } }, diff --git a/src/pipeline/null.rs b/src/pipeline/null.rs index 0670a72..8b89e6d 100644 --- a/src/pipeline/null.rs +++ b/src/pipeline/null.rs @@ -165,7 +165,7 @@ impl<'c> Ctx<'c> { pub fn int_sub_v(&self, args: &[&Dynamic<'c>]) -> Dynamic<'c> { match *args { [] => self.int_some(Int::from_i64(self.solver.get_context(), 0)), - [arg] => arg.clone(), + [arg] => self.int_unary_minus(arg), [arg, ref args @ ..] => args.iter().fold(arg.clone(), |a, b| self.int_sub(&a, b)), } } @@ -186,7 +186,7 @@ impl<'c> Ctx<'c> { pub fn real_sub_v(&self, args: &[&Dynamic<'c>]) -> Dynamic<'c> { match *args { [] => self.real_some(Real::from_real(self.solver.get_context(), 0, 1)), - [arg] => arg.clone(), + [arg] => self.real_unary_minus(arg), [arg, ref args @ ..] => args.iter().fold(arg.clone(), |a, b| self.real_sub(&a, b)), } } diff --git a/src/pipeline/relation.rs b/src/pipeline/relation.rs index 1e11f25..48f8047 100644 --- a/src/pipeline/relation.rs +++ b/src/pipeline/relation.rs @@ -342,9 +342,9 @@ pub enum JoinKind { #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct AggCall { - #[serde(rename = "operator")] + #[serde(alias = "operator")] op: String, - #[serde(rename = "operand")] + #[serde(alias = "operand")] args: Vec, #[serde(default = "default_distinct")] distinct: bool, @@ -379,9 +379,11 @@ impl Eval<(AggCall, Relation), syntax::Expr> for Env<'_> { op: "IS NOT NULL".into(), args: vec![Expr::Col { column: VL(i), ty }], ty: DataType::Boolean, + rel: None, }) .collect_vec(); - let condition = Expr::Op { op: "AND".into(), args: conditions, ty: DataType::Boolean }; + let condition = + Expr::Op { op: "AND".into(), args: conditions, ty: DataType::Boolean, rel: None }; Relation::Filter { condition, source: source.into() } } else { source @@ -409,23 +411,15 @@ pub enum Expr { #[serde(alias = "type")] ty: DataType, }, - HOp { - #[serde(rename = "operator")] - op: String, - #[serde(rename = "operand")] - args: Vec, - #[serde(rename = "query")] - rel: Box, - #[serde(alias = "type")] - ty: DataType, - }, Op { - #[serde(rename = "operator")] + #[serde(alias = "operator")] op: String, - #[serde(rename = "operand")] + #[serde(alias = "operand")] args: Vec, #[serde(alias = "type")] ty: DataType, + #[serde(alias = "query")] + rel: Option>, }, } @@ -434,7 +428,6 @@ impl Expr { match self { Expr::Col { ty, .. } => ty, Expr::Op { ty, .. } => ty, - Expr::HOp { ty, .. } => ty, } .clone() } @@ -443,53 +436,73 @@ impl Expr { if self.ty() == DataType::Real { self } else { - Expr::Op { op: "CAST".to_string(), args: vec![self], ty: DataType::Real } + Expr::Op { op: "CAST".to_string(), args: vec![self], ty: DataType::Real, rel: None } } } } +pub fn num_op(op: &str) -> bool { + matches!( + op, + "+" | "PLUS" | "UNARY PLUS" | "-" | "MINUS" | "UNARY MINUS" | "*" | "MULT" | "/" | "DIV" + ) +} + +pub fn num_cmp(op: &str) -> bool { + matches!(op, |">"| "GT" + | "<" | "LT" + | ">=" | "GE" + | "<=" | "LE" + | "=" | "EQ" + | "<>" | "!=" + | "NE") +} + impl Eval for Env<'_> { fn eval(self, source: Expr) -> syntax::Expr { use shared::Expr::*; - self.eval_logic(&source).map(|l| Log(l.into())).unwrap_or_else(|| { - match source { - Expr::Col { column, ty: _ } => self.1[column.0].clone(), - Expr::Op { op, args, ty } => { - let cast = matches!(op.as_str(), "+" | "-" | "*" | "/" if ty == DataType::Real) - || matches!(op.as_str(), ">" | "<" | ">=" | "<=" | "=" | "<>" | "!=" if args.iter().any(|e| e.ty() == DataType::Real)); - let args = - if cast { args.into_iter().map(Expr::into_real).collect() } else { args }; - Op(op, self.eval(args), ty) - }, - Expr::HOp { op, args, rel, ty } => HOp(op, self.eval(args), self.eval(*rel).into(), ty), - } - }) + match source { + e if let Some(l) = self.eval_logic(&e) => Log(l.into()), + Expr::Col { column, ty: _ } => self.1[column.0].clone(), + Expr::Op { op, args, ty, rel: None } => { + let cast = (num_op(&op) && ty == DataType::Real) + || (num_cmp(&op) && args.iter().any(|e| e.ty() == DataType::Real)); + let args = + if cast { args.into_iter().map(Expr::into_real).collect() } else { args }; + Op(op, self.eval(args), ty) + }, + Expr::Op { op, args, rel: Some(rel), ty } => { + HOp(op, self.eval(args), self.eval(*rel).into(), ty) + }, + } } } impl Env<'_> { fn eval_logic(self, source: &Expr) -> Option { match source { - Expr::Op { op, args, ty: DataType::Boolean } => match op.to_uppercase().as_str() { - "TRUE" => Some(Logic::tt()), - "FALSE" => Some(Logic::ff()), - "<=>" | "IS NOT DISTINCT FROM" => { - Some(Logic::Eq(self.eval(args[0].clone()), self.eval(args[1].clone()))) - }, - "IS DISTINCT FROM" => { - Some(!Logic::Eq(self.eval(args[0].clone()), self.eval(args[1].clone()))) - }, - "IS NULL" => { - let e: syntax::Expr = self.eval(args[0].clone()); - Some(e.is_null()) - }, - "IS NOT NULL" => { - let e: syntax::Expr = self.eval(args[0].clone()); - Some(!e.is_null()) - }, - _ => None, + Expr::Op { op, args, ty: DataType::Boolean, rel: None } => { + match op.to_uppercase().as_str() { + "TRUE" => Some(Logic::tt()), + "FALSE" => Some(Logic::ff()), + "<=>" | "IS" | "IS NOT DISTINCT FROM" => { + Some(Logic::Eq(self.eval(args[0].clone()), self.eval(args[1].clone()))) + }, + "IS NOT" | "IS DISTINCT FROM" => { + Some(!Logic::Eq(self.eval(args[0].clone()), self.eval(args[1].clone()))) + }, + "IS NULL" => { + let e: syntax::Expr = self.eval(args[0].clone()); + Some(e.is_null()) + }, + "IS NOT NULL" => { + let e: syntax::Expr = self.eval(args[0].clone()); + Some(!e.is_null()) + }, + _ => None, + } }, - Expr::HOp { op, args: _, rel, ty: DataType::Boolean } => match op.as_str() { + Expr::Op { op, args: _, rel: Some(rel), ty: DataType::Boolean } => match op.as_str() { "EXISTS" => { let Env(schemas, subst, lvl) = self; let scope = rel.scope(schemas); @@ -507,13 +520,14 @@ impl Env<'_> { impl Eval for Env<'_> { fn eval(self, source: Expr) -> Logic { assert_eq!(source.ty(), DataType::Boolean, "wrong type for predicate"); - self.eval_logic(&source).unwrap_or_else(|| match source.clone() { + match source.clone() { + e if let Some(l) = self.eval_logic(&e) => l, Expr::Op { op, args, .. } => match op.to_uppercase().as_str() { "AND" => Logic::And(args.into_iter().map(|arg| self.eval(arg)).collect()), "OR" => Logic::Or(args.into_iter().map(|arg| self.eval(arg)).collect()), _ => Logic::Bool(self.eval(source)), }, - Expr::Col { .. } | Expr::HOp { .. } => Logic::Bool(self.eval(source)), - }) + Expr::Col { .. } => Logic::Bool(self.eval(source)), + } } } diff --git a/src/pipeline/shared.rs b/src/pipeline/shared.rs index 292e9f5..7bb3bc2 100644 --- a/src/pipeline/shared.rs +++ b/src/pipeline/shared.rs @@ -311,6 +311,7 @@ pub enum DataType { #[serde(alias = "FLOAT", alias = "DOUBLE", alias = "DECIMAL")] Real, /// Boolean + #[serde(alias = "BOOL")] Boolean, /// String #[serde(alias = "VARCHAR", alias = "CHAR", alias = "TEXT")] diff --git a/src/pipeline/unify.rs b/src/pipeline/unify.rs index 7382623..fd81680 100644 --- a/src/pipeline/unify.rs +++ b/src/pipeline/unify.rs @@ -253,7 +253,7 @@ pub(crate) fn smt<'c>(solver: &'c z3::Solver, pred: Bool<'c>) -> bool { log::info!("Z3 result: {}", result); let provable = result.starts_with("unsat\n"); res.fetch_or(provable); - if !result.starts_with("unknown\n") { + if result.starts_with("unsat\n") || result.starts_with("sat\n") { u1.unpark(); } }); @@ -266,7 +266,7 @@ pub(crate) fn smt<'c>(solver: &'c z3::Solver, pred: Bool<'c>) -> bool { log::info!("CVC5 result: {}", result); let provable = result.ends_with("unsat\n"); res.fetch_or(provable); - if !result.ends_with("unknown\n") { + if result.starts_with("unsat\n") || result.starts_with("sat\n") { u2.unpark(); } }); From a55d2577c473bf4c27abc2435d50f7fce05c0e0b Mon Sep 17 00:00:00 2001 From: Shuxian Wang Date: Tue, 11 Jul 2023 20:55:03 -0700 Subject: [PATCH 06/11] Update Calcite cases. --- .../testAddRedundantSemiJoinRule.json | 1 - .../benchmark/testAggregateCaseToFilter.json | 1 - .../testAggregateConstantKeyRule.json | 1 - .../testAggregateConstantKeyRule3.json | 1 - .../testAggregateDynamicFunction.json | 1 - .../testAggregateExtractProjectRule.json | 1 - ...ateExtractProjectRuleWithGroupingSets.json | 1 - ...teExtractProjectRuleWithGroupingSets2.json | 1 - ...testAggregateGroupingSetsProjectMerge.json | 1 - tests/benchmark/testAggregateJoinRemove1.json | 1 - .../benchmark/testAggregateJoinRemove10.json | 1 - .../benchmark/testAggregateJoinRemove11.json | 1 - tests/benchmark/testAggregateJoinRemove2.json | 1 - tests/benchmark/testAggregateJoinRemove3.json | 1 - tests/benchmark/testAggregateJoinRemove4.json | 1 - tests/benchmark/testAggregateJoinRemove5.json | 1 - tests/benchmark/testAggregateJoinRemove6.json | 1 - tests/benchmark/testAggregateJoinRemove7.json | 1 - tests/benchmark/testAggregateJoinRemove8.json | 1 - tests/benchmark/testAggregateJoinRemove9.json | 1 - tests/benchmark/testAggregateMerge1.json | 1 - tests/benchmark/testAggregateMerge2.json | 1 - tests/benchmark/testAggregateMerge8.json | 1 - tests/benchmark/testAggregateMergeSum0.json | 1 - .../benchmark/testAggregateProjectMerge.json | 1 - .../testAggregateProjectPullUpConstants.json | 1 - .../testAggregateProjectPullUpConstants2.json | 1 - tests/benchmark/testAggregateRemove1.json | 1 - tests/benchmark/testAggregateRemove2.json | 1 - tests/benchmark/testAggregateRemove3.json | 1 - tests/benchmark/testAggregateRemove7.json | 1 - ...egateUnionTransposeWithOneInputUnique.json | 1 - ...ransposeWithTopLevelGroupSetRemapping.json | 1 - tests/benchmark/testAll.json | 1 - .../testAlreadyFalseEliminatesFilter.json | 1 - .../testAntiJoinProjectTranspose.json | 1 - .../testAnyInProjectNonNullable.json | 1 - tests/benchmark/testAnyInProjectNullable.json | 1 - ...ReuseDistinctAttrWithMixedOptionality.json | 1 - ...ReuseDistinctAttrWithMixedOptionality.json | 1 - .../testCasePushIsAlwaysWorking.json | 1 - ...AggregateExpandDistinctAggregatesRule.json | 1 - .../testCastInAggregateReduceFunctions.json | 1 - ...omColumnResolvingInCorrelatedSubQuery.json | 1 - ...mColumnResolvingInCorrelatedSubQuery2.json | 1 - ...olumnResolvingInNonCorrelatedSubQuery.json | 1 - ...estDecorrelateAggWithConstantGroupKey.json | 1 - tests/benchmark/testDecorrelateExists.json | 1 - tests/benchmark/testDecorrelateTwoExists.json | 1 - tests/benchmark/testDecorrelateTwoIn.json | 1 - ...lateUncorrelatedInAndCorrelatedExists.json | 1 - ...estOfApproximateDistinctAggregateCall.json | 1 - tests/benchmark/testDistinctCount1.json | 1 - tests/benchmark/testDistinctCount2.json | 1 - tests/benchmark/testDistinctCount3.json | 1 - .../testDistinctCountGroupingSets1.json | 1 - .../testDistinctCountGroupingSets2.json | 1 - tests/benchmark/testDistinctCountMixed.json | 1 - tests/benchmark/testDistinctCountMixed2.json | 1 - .../benchmark/testDistinctCountMixedJoin.json | 1 - .../benchmark/testDistinctCountMultiple.json | 1 - .../testDistinctCountMultipleNoGroup.json | 1 - .../testDistinctCountMultipleViaJoin.json | 1 - .../testDistinctCountWithExpandSumType.json | 1 - .../testDistinctCountWithoutGroupBy.json | 1 - .../testDistinctNonDistinctAggregates.json | 1 - ...nctNonDistinctAggregatesWithGrouping1.json | 1 - ...nctNonDistinctAggregatesWithGrouping2.json | 1 - ...tNonDistinctTwoAggregatesWithGrouping.json | 1 - ...istinctWithDiffFiltersAndSameGroupSet.json | 1 - .../testDistinctWithFilterAndGroupBy.json | 1 - .../testDistinctWithFilterWithoutGroupBy.json | 1 - tests/benchmark/testDistinctWithGrouping.json | 1 - .../testDistinctWithMultipleInputs.json | 1 - ...tDistinctWithMultipleInputsAndGroupby.json | 1 - tests/benchmark/testEmptyAggregate.json | 1 - ...regateEmptyKeyWithAggregateValuesRule.json | 1 - .../testEmptyFilterProjectUnion.json | 1 - tests/benchmark/testEmptyIntersect.json | 1 - tests/benchmark/testEmptyMinus.json | 1 - tests/benchmark/testEmptyMinus2.json | 1 - tests/benchmark/testEmptyProject.json | 1 - tests/benchmark/testEmptyProject2.json | 1 - tests/benchmark/testEmptySort.json | 1 - tests/benchmark/testEmptySort2.json | 1 - tests/benchmark/testEmptySortLimitZero.json | 1 - .../testExistsWithAtLeastOneRowSubQuery.json | 1 - .../testExistsWithNoRowSubQuery.json | 1 - tests/benchmark/testExpandFilterExists.json | 1 - .../testExpandFilterExistsSimple.json | 1 - .../testExpandFilterExistsSimpleAnd.json | 1 - tests/benchmark/testExpandFilterIn.json | 1 - tests/benchmark/testExpandFilterIn3Value.json | 1 - .../testExpandFilterInComposite.json | 1 - tests/benchmark/testExpandFilterScalar.json | 1 - tests/benchmark/testExpandJoinExists.json | 1 - tests/benchmark/testExpandJoinScalar.json | 1 - tests/benchmark/testExpandProjectExists.json | 1 - tests/benchmark/testExpandProjectIn.json | 1 - .../testExpandProjectInComposite.json | 1 - .../testExpandProjectInNullable.json | 1 - tests/benchmark/testExpandProjectScalar.json | 1 - .../testExpandWhereComparisonCorrelated.json | 1 - .../testExpressionSimplification1.json | 1 - .../testExpressionSimplification2.json | 1 - .../benchmark/testExtractJoinFilterRule.json | 1 - .../testExtractYearMonthToRange.json | 1 - tests/benchmark/testExtractYearToRange.json | 1 - .../testFilterJoinRuleAndIsNotNull.json | 1 - .../testFilterJoinRuleOrIsNotNull.json | 1 - .../benchmark/testFilterProjectTranspose.json | 1 - ...testFilterRemoveIsNotDistinctFromRule.json | 1 - ...estFlattenUncorrelatedCallBelowEquals.json | 1 - ...elatedTwoLevelCallBelowEqualsSucceeds.json | 1 - ...estFullOuterJoinSimplificationToInner.json | 1 - ...ullOuterJoinSimplificationToLeftOuter.json | 1 - ...llOuterJoinSimplificationToRightOuter.json | 1 - .../testGroupByBooleanLiteralSimple.json | 1 - .../testGroupByDateLiteralSimple.json | 1 - .../testGroupByMultipleLiterals.json | 1 - ...dicatesWithNotOperatorInJoinCondition.json | 1 - tests/benchmark/testIntersectToDistinct.json | 1 - tests/benchmark/testIsNullPushDown.json | 1 - tests/benchmark/testIsNullPushDown2.json | 1 - ...eWithBottomAlwaysTrueConditionAllowed.json | 1 - ...RuleWithTopAlwaysTrueConditionAllowed.json | 1 - ...uteRuleWithAlwaysTrueConditionAllowed.json | 1 - .../benchmark/testJoinConditionPushdown1.json | 1 - .../benchmark/testJoinConditionPushdown2.json | 1 - .../benchmark/testJoinConditionPushdown4.json | 1 - .../benchmark/testJoinConditionPushdown6.json | 1 - .../testJoinDeriveIsNotNullFilterRule1.json | 1 - .../testJoinDeriveIsNotNullFilterRule12.json | 1 - .../testJoinDeriveIsNotNullFilterRule2.json | 1 - .../testJoinDeriveIsNotNullFilterRule3.json | 1 - .../testJoinDeriveIsNotNullFilterRule4.json | 1 - .../testJoinDeriveIsNotNullFilterRule5.json | 1 - .../benchmark/testJoinProjectTranspose1.json | 1 - .../benchmark/testJoinProjectTranspose7.json | 1 - .../benchmark/testJoinProjectTranspose8.json | 1 - .../testJoinProjectTransposeWindow.json | 1 - ...testJoinPushTransitivePredicatesRule2.json | 1 - tests/benchmark/testLeftEmptyAntiJoin.json | 1 - tests/benchmark/testLeftEmptyFullJoin.json | 1 - tests/benchmark/testLeftEmptyInnerJoin.json | 1 - tests/benchmark/testLeftEmptyLeftJoin.json | 1 - tests/benchmark/testLeftEmptyRightJoin.json | 1 - tests/benchmark/testLeftEmptySemiJoin.json | 1 - ...estLeftOuterJoinSimplificationToInner.json | 1 - ...ReuseDistinctAttrWithMixedOptionality.json | 1 - tests/benchmark/testMergeFilter.json | 1 - tests/benchmark/testMergeIntersect.json | 1 - tests/benchmark/testMergeJoinFilter.json | 1 - tests/benchmark/testMergeMinus.json | 1 - tests/benchmark/testMergeUnionAll.json | 1 - tests/benchmark/testMergeUnionDistinct.json | 1 - tests/benchmark/testMergeUnionMixed2.json | 1 - ...ReuseDistinctAttrWithMixedOptionality.json | 1 - tests/benchmark/testMinusMergeRule.json | 1 - .../testMultipleDistinctWithGrouping.json | 1 - .../testNoOversimplificationBelowIsNull.json | 1 - tests/benchmark/testOrAlwaysTrue.json | 1 - tests/benchmark/testOrAlwaysTrue2.json | 1 - .../testOversimplifiedCaseStatement.json | 1 - .../benchmark/testProjectAggregateMerge.json | 1 - .../testProjectAggregateMergeSum0.json | 1 - .../testProjectAggregateMergeSum0AndSum.json | 1 - ...ctCorrelateTransposeRuleLeftCorrelate.json | 1 - tests/benchmark/testProjectJoinRemove1.json | 1 - tests/benchmark/testProjectJoinRemove10.json | 1 - tests/benchmark/testProjectJoinRemove4.json | 1 - tests/benchmark/testProjectJoinRemove7.json | 1 - .../testProjectJoinTransposeItem.json | 1 - .../benchmark/testProjectSetOpTranspose.json | 1 - .../testPullAggregateThroughUnion.json | 1 - .../testPullAggregateThroughUnion2.json | 1 - ...llAggregateThroughUnionAndAddProjects.json | 1 - ...estPullAggregateThroughUnionWithAlias.json | 1 - .../benchmark/testPullConstantIntoFilter.json | 1 - tests/benchmark/testPullConstantIntoJoin.json | 1 - .../benchmark/testPullConstantIntoJoin2.json | 1 - .../testPullConstantIntoProject.json | 1 - ...stantIntoProjectWithIsNotDistinctFrom.json | 1 - ...toProjectWithIsNotDistinctFromForNull.json | 1 - ...tPullConstantThroughAggregateAllConst.json | 1 - ...llConstantThroughAggregateAllLiterals.json | 1 - ...lConstantThroughAggregateConstGroupBy.json | 1 - ...tPullConstantThroughAggregatePermuted.json | 1 - ...antThroughAggregatePermutedConstFirst.json | 1 - ...tThroughAggregatePermutedConstGroupBy.json | 1 - ...tantThroughAggregateSimpleNonNullable.json | 1 - .../testPullConstantThroughConstLast.json | 1 - .../testPullConstantThroughUnion.json | 1 - .../testPullConstantThroughUnion3.json | 1 - .../testPullFilterThroughAggregate.json | 1 - ...ullFilterThroughAggregateGroupingSets.json | 1 - tests/benchmark/testPullNull.json | 1 - ...ushAboveFiltersIntoInnerJoinCondition.json | 1 - ...testPushAggregateFunctionsThroughJoin.json | 1 - .../testPushAggregateSumNoGroup.json | 1 - .../testPushAggregateSumThroughJoin.json | 1 - ...ateSumThroughJoinAfterAggregateReduce.json | 1 - ...ggregateSumWithoutGroupKeyThroughJoin.json | 1 - .../testPushAggregateThroughJoin1.json | 1 - .../testPushAggregateThroughJoin2.json | 1 - .../testPushAggregateThroughJoin4.json | 1 - .../testPushAggregateThroughJoin5.json | 1 - .../testPushAggregateThroughJoin6.json | 1 - .../testPushAggregateThroughJoin7.json | 1 - .../testPushAggregateThroughJoin8.json | 1 - .../testPushAggregateThroughJoinDistinct.json | 1 - ...regateThroughJoinOnEmptyLogicalValues.json | 1 - ...shAggregateThroughJoinWithUniqueInput.json | 1 - .../testPushAggregateThroughOuterJoin1.json | 1 - .../testPushAggregateThroughOuterJoin12.json | 1 - .../testPushAggregateThroughOuterJoin13.json | 1 - .../testPushAggregateThroughOuterJoin14.json | 1 - .../testPushAggregateThroughOuterJoin15.json | 1 - .../testPushAggregateThroughOuterJoin16.json | 1 - .../testPushAggregateThroughOuterJoin2.json | 1 - .../testPushAggregateThroughOuterJoin3.json | 1 - .../testPushAggregateThroughOuterJoin4.json | 1 - .../testPushAggregateThroughOuterJoin5.json | 1 - .../testPushAggregateThroughOuterJoin6.json | 1 - .../testPushAggregateThroughOuterJoin7.json | 1 - .../testPushAggregateThroughOuterJoin8.json | 1 - .../testPushAggregateThroughOuterJoin9.json | 1 - .../testPushAvgGroupingSetsThroughUnion.json | 1 - tests/benchmark/testPushAvgThroughUnion.json | 1 - .../testPushBoolAndBoolOrThroughUnion.json | 1 - .../testPushCountFilterThroughUnion.json | 1 - ...CountNullableGroupingSetsThroughUnion.json | 1 - .../testPushCountNullableThroughUnion.json | 1 - ...PushCountStarGroupingSetsThroughUnion.json | 1 - .../testPushCountStarThroughUnion.json | 1 - tests/benchmark/testPushFilterPastAgg.json | 1 - .../benchmark/testPushFilterPastAggFour.json | 1 - tests/benchmark/testPushFilterPastAggTwo.json | 1 - ...estPushFilterPastAggWithGroupingSets2.json | 1 - .../benchmark/testPushFilterPastProject.json | 1 - tests/benchmark/testPushFilterSemijoin.json | 1 - .../testPushFilterThroughSemiJoin.json | 1 - ...shFilterWithIsNotDistinctFromPastJoin.json | 1 - .../testPushJoinCondDownToProject.json | 1 - .../testPushJoinThroughUnionOnLeft.json | 1 - .../testPushJoinThroughUnionOnRight.json | 1 - ...shMaxNullableGroupingSetsThroughUnion.json | 1 - .../testPushMaxNullableThroughUnion.json | 1 - .../testPushMinGroupingSetsThroughUnion.json | 1 - tests/benchmark/testPushMinThroughUnion.json | 1 - .../benchmark/testPushProjectPastFilter.json | 1 - .../benchmark/testPushProjectPastFilter2.json | 1 - .../testPushProjectPastFilter3b.json | 1 - .../testPushProjectPastFilter3c.json | 1 - .../testPushProjectPastFullJoin.json | 1 - .../testPushProjectPastFullJoinStrong.json | 1 - .../testPushProjectPastInnerJoin.json | 1 - .../testPushProjectPastInnerJoinStrong.json | 1 - tests/benchmark/testPushProjectPastJoin.json | 1 - .../testPushProjectPastLeftJoin.json | 1 - .../testPushProjectPastLeftJoinSwap.json | 1 - ...testPushProjectPastLeftJoinSwapStrong.json | 1 - .../testPushProjectPastRightJoin.json | 1 - .../testPushProjectPastRightJoinStrong.json | 1 - .../testPushProjectPastRightJoinSwap.json | 1 - ...estPushProjectPastRightJoinSwapStrong.json | 1 - tests/benchmark/testPushProjectPastSetOp.json | 1 - ...hProjectWithIsNotDistinctFromPastJoin.json | 1 - .../testPushProjectWithOverPastJoin1.json | 1 - .../testPushProjectWithOverPastJoin2.json | 1 - .../testPushProjectWithOverPastJoin3.json | 1 - .../benchmark/testPushSemiJoinConditions.json | 1 - .../benchmark/testPushSemiJoinPastFilter.json | 1 - .../testPushSemiJoinPastJoinRuleLeft.json | 1 - .../testPushSemiJoinPastJoinRuleRight.json | 1 - .../testPushSemiJoinPastProject.json | 1 - ...shSumConstantGroupingSetsThroughUnion.json | 1 - .../testPushSumConstantThroughUnion.json | 1 - ...hSumCountStarGroupingSetsThroughUnion.json | 1 - .../testPushSumCountStarThroughUnion.json | 1 - ...mNullConstantGroupingSetsThroughUnion.json | 1 - .../testPushSumNullConstantThroughUnion.json | 1 - ...shSumNullableGroupingSetsThroughUnion.json | 1 - .../testPushSumNullableNOGBYThroughUnion.json | 1 - .../testPushSumNullableThroughUnion.json | 1 - .../testReduceAggregateFunctionsByGroup.json | 1 - .../testReduceAllAggregateFunctions.json | 1 - tests/benchmark/testReduceAverage.json | 1 - ...AverageAndSumWithNoReduceStddevAndVar.json | 1 - ...ReduceAverageAndVarWithNoReduceStddev.json | 1 - .../testReduceAverageWithNoReduceSum.json | 1 - tests/benchmark/testReduceCase.json | 1 - .../testReduceCaseNullabilityChange.json | 1 - tests/benchmark/testReduceCastAndConsts.json | 1 - tests/benchmark/testReduceCasts.json | 1 - .../testReduceCompositeInSubQuery.json | 1 - tests/benchmark/testReduceConstants.json | 1 - tests/benchmark/testReduceConstants3.json | 1 - .../testReduceConstantsCaseEquals.json | 1 - .../testReduceConstantsCaseEquals2.json | 1 - .../testReduceConstantsCaseEquals3.json | 1 - tests/benchmark/testReduceConstantsDup.json | 1 - tests/benchmark/testReduceConstantsDup2.json | 1 - tests/benchmark/testReduceConstantsDup3.json | 1 - .../testReduceConstantsDup3Null.json | 1 - .../benchmark/testReduceConstantsDupNot.json | 1 - .../benchmark/testReduceConstantsDupNot2.json | 1 - .../testReduceConstantsDupNot2Null.json | 1 - .../testReduceConstantsDupNotNull.json | 1 - .../testReduceConstantsEliminatesFilter.json | 1 - .../testReduceConstantsIsNotNull.json | 1 - .../benchmark/testReduceConstantsIsNull.json | 1 - .../benchmark/testReduceConstantsNegated.json | 1 - .../testReduceConstantsNegatedInverted.json | 1 - tests/benchmark/testReduceConstantsNull.json | 1 - .../testReduceConstantsNullEqualsOne.json | 1 - .../testReduceConstantsProjectNullable.json | 1 - .../testReduceConstantsRequiresExecutor.json | 1 - tests/benchmark/testReduceDynamic.json | 1 - tests/benchmark/testReduceNestedCaseWhen.json | 1 - .../testReduceNullableToNotNull.json | 1 - .../testReduceNullableToNotNull2.json | 1 - tests/benchmark/testReduceOrCaseWhen.json | 1 - tests/benchmark/testReduceValuesToEmpty.json | 1 - .../testReduceValuesUnderFilter.json | 1 - .../testReduceValuesUnderProject.json | 1 - .../testReduceValuesUnderProjectFilter.json | 1 - .../testReduceWithNonTypePredicate.json | 1 - tests/benchmark/testRemoveDistinctOnAgg.json | 1 - tests/benchmark/testRemoveSemiJoin.json | 1 - tests/benchmark/testRemoveSemiJoinRight.json | 1 - .../testRemoveSemiJoinRightWithFilter.json | 1 - .../testRemoveSemiJoinWithFilter.json | 1 - tests/benchmark/testRightEmptyAntiJoin.json | 1 - .../testRightEmptyAntiJoinNonEqui.json | 1 - tests/benchmark/testRightEmptyFullJoin.json | 1 - tests/benchmark/testRightEmptyInnerJoin.json | 1 - tests/benchmark/testRightEmptyLeftJoin.json | 1 - tests/benchmark/testRightEmptyRightJoin.json | 1 - tests/benchmark/testRightEmptySemiJoin.json | 1 - ...stRightOuterJoinSimplificationToInner.json | 1 - .../testSemiJoinProjectTranspose.json | 1 - .../testSemiJoinReduceConstants.json | 1 - tests/benchmark/testSemiJoinRule.json | 1 - tests/benchmark/testSemiJoinRuleExists.json | 1 - tests/benchmark/testSemiJoinRuleLeft.json | 1 - tests/benchmark/testSemiJoinRuleWithHint.json | 1 - ...testSemiJoinRuleWithJoinOnUniqueInput.json | 1 - tests/benchmark/testSemiJoinTrim.json | 1 - tests/benchmark/testSimplifyFilter.json | 1 - .../testSkipReduceConstantsCaseEquals.json | 1 - tests/benchmark/testSome.json | 1 - tests/benchmark/testSomeWithEquality.json | 1 - tests/benchmark/testSomeWithEquality2.json | 1 - tests/benchmark/testSomeWithNotEquality.json | 1 - .../testSortJoinCopyInnerJoinOrderBy.json | 1 - ...testSortJoinCopyInnerJoinOrderByLimit.json | 1 - ...SortJoinCopyInnerJoinOrderByTwoFields.json | 1 - .../testSortJoinCopySemiJoinOrderBy.json | 1 - ...ortJoinCopySemiJoinOrderByLimitOffset.json | 1 - ...testSortJoinCopySemiJoinOrderByOffset.json | 1 - tests/benchmark/testSortJoinTranspose1.json | 1 - tests/benchmark/testSortJoinTranspose2.json | 1 - tests/benchmark/testSortJoinTranspose4.json | 1 - tests/benchmark/testSortJoinTranspose6.json | 1 - .../benchmark/testSortProjectTranspose1.json | 1 - .../benchmark/testSortProjectTranspose2.json | 1 - .../testSortRemovalAllKeysConstant.json | 1 - .../testSortRemovalOneKeyConstant.json | 1 - tests/benchmark/testSortUnionTranspose.json | 1 - tests/benchmark/testSortUnionTranspose2.json | 1 - tests/benchmark/testSortUnionTranspose3.json | 1 - tests/benchmark/testSpatialContainsPoint.json | 1 - tests/benchmark/testSpatialDWithinLine.json | 1 - .../benchmark/testSpatialDWithinReversed.json | 1 - .../testSpatialDWithinToHilbert.json | 1 - .../testSpatialDWithinToHilbertNegative.json | 1 - .../testSpatialDWithinToHilbertZero.json | 1 - tests/benchmark/testSpatialReduce.json | 1 - tests/benchmark/testStrengthenJoinType.json | 1 - ...estSumAndDistinctSumWithExpandSumType.json | 1 - tests/benchmark/testSwapOuterJoin.json | 1 - .../testTransitiveInferenceAggregate.json | 1 - ...stTransitiveInferenceComplexPredicate.json | 1 - ...stTransitiveInferenceConjunctInPullUp.json | 1 - .../testTransitiveInferenceJoin.json | 1 - .../testTransitiveInferenceJoin3way.json | 1 - .../testTransitiveInferenceJoin3wayAgg.json | 1 - .../testTransitiveInferenceLeftOuterJoin.json | 1 - .../testTransitiveInferenceProject.json | 1 - ...estTransitiveInferencePullUpThruAlias.json | 1 - ...testTransitiveInferenceRightOuterJoin.json | 1 - .../testTransitiveInferenceUnion.json | 1 - .../testTransitiveInferenceUnion3way.json | 1 - ...estTransitiveInferenceUnionAlwaysTrue.json | 1 - ...IsFlattenedOnlyIfSiblingOfCorrelation.json | 1 - tests/benchmark/testUnionMergeRule.json | 1 - tests/benchmark/testUnionToDistinctRule.json | 1 - .../testWhereAnyCorrelatedInSelect.json | 1 - .../testWhereExpressionInCorrelated.json | 1 - .../testWhereExpressionInCorrelated2.json | 1 - tests/benchmark/testWhereInCorrelated.json | 1 - .../benchmark/testWhereInJoinCorrelated.json | 1 - tests/benchmark/testWhereNotInCorrelated.json | 1 - .../benchmark/testWhereNotInCorrelated2.json | 1 - tests/benchmark/testWhereOrSubQuery.json | 1 - tests/benchmark/testWithinDistinct.json | 1 - .../testWithinDistinctCountDistinct.json | 1 - .../testWithinDistinctFilteredAggs.json | 1 - ...tWithinDistinctFilteredAggsSameFilter.json | 1 - ...stinctFilteredAggsUniformDistinctKeys.json | 1 - ...ilteredAggsUniformDistinctKeysNoThrow.json | 1 - .../benchmark/testWithinDistinctNoThrow.json | 1 - ...testWithinDistinctUniformDistinctKeys.json | 1 - ...hinDistinctUniformDistinctKeysNoThrow.json | 1 - .../calcite/testAddRedundantSemiJoinRule.json | 98 + tests/calcite/testAggregateCaseToFilter.json | 993 +++++++++ .../calcite/testAggregateConstantKeyRule.json | 250 +++ .../testAggregateConstantKeyRule3.json | 326 +++ .../calcite/testAggregateDynamicFunction.json | 326 +++ .../testAggregateExtractProjectRule.json | 100 + ...ateExtractProjectRuleWithGroupingSets.json | 164 ++ ...teExtractProjectRuleWithGroupingSets2.json | 158 ++ ...testAggregateGroupingSetsProjectMerge.json | 206 ++ tests/calcite/testAggregateJoinRemove1.json | 153 ++ tests/calcite/testAggregateJoinRemove10.json | 303 +++ tests/calcite/testAggregateJoinRemove11.json | 177 ++ tests/calcite/testAggregateJoinRemove2.json | 177 ++ tests/calcite/testAggregateJoinRemove3.json | 215 ++ tests/calcite/testAggregateJoinRemove4.json | 123 ++ tests/calcite/testAggregateJoinRemove5.json | 177 ++ tests/calcite/testAggregateJoinRemove6.json | 215 ++ tests/calcite/testAggregateJoinRemove7.json | 229 ++ tests/calcite/testAggregateJoinRemove8.json | 253 +++ tests/calcite/testAggregateJoinRemove9.json | 261 +++ tests/calcite/testAggregateMerge1.json | 365 ++++ tests/calcite/testAggregateMerge2.json | 352 ++++ tests/calcite/testAggregateMerge8.json | 188 ++ tests/calcite/testAggregateMergeSum0.json | 195 ++ tests/calcite/testAggregateProjectMerge.json | 206 ++ .../testAggregateProjectPullUpConstants.json | 281 +++ .../testAggregateProjectPullUpConstants2.json | 181 ++ tests/calcite/testAggregateRemove1.json | 202 ++ tests/calcite/testAggregateRemove2.json | 100 + tests/calcite/testAggregateRemove3.json | 142 ++ tests/calcite/testAggregateRemove7.json | 408 ++++ ...egateUnionTransposeWithOneInputUnique.json | 836 ++++++++ ...ransposeWithTopLevelGroupSetRemapping.json | 720 +++++++ tests/calcite/testAll.json | 367 ++++ .../testAlreadyFalseEliminatesFilter.json | 54 + .../calcite/testAntiJoinProjectTranspose.json | 236 +++ .../calcite/testAnyInProjectNonNullable.json | 269 +++ tests/calcite/testAnyInProjectNullable.json | 282 +++ ...ReuseDistinctAttrWithMixedOptionality.json | 244 +++ ...ReuseDistinctAttrWithMixedOptionality.json | 244 +++ .../calcite/testCasePushIsAlwaysWorking.json | 112 + ...AggregateExpandDistinctAggregatesRule.json | 830 ++++++++ .../testCastInAggregateReduceFunctions.json | 479 +++++ ...omColumnResolvingInCorrelatedSubQuery.json | 310 +++ ...mColumnResolvingInCorrelatedSubQuery2.json | 253 +++ ...olumnResolvingInNonCorrelatedSubQuery.json | 208 ++ ...estDecorrelateAggWithConstantGroupKey.json | 581 ++++++ tests/calcite/testDecorrelateExists.json | 192 ++ tests/calcite/testDecorrelateTwoExists.json | 366 ++++ tests/calcite/testDecorrelateTwoIn.json | 202 ++ ...lateUncorrelatedInAndCorrelatedExists.json | 335 +++ ...estOfApproximateDistinctAggregateCall.json | 278 +++ tests/calcite/testDistinctCount1.json | 234 +++ tests/calcite/testDistinctCount2.json | 424 ++++ tests/calcite/testDistinctCount3.json | 390 ++++ .../testDistinctCountGroupingSets1.json | 428 ++++ .../testDistinctCountGroupingSets2.json | 531 +++++ tests/calcite/testDistinctCountMixed.json | 452 ++++ tests/calcite/testDistinctCountMixed2.json | 532 +++++ tests/calcite/testDistinctCountMixedJoin.json | 733 +++++++ tests/calcite/testDistinctCountMultiple.json | 420 ++++ .../testDistinctCountMultipleNoGroup.json | 316 +++ .../testDistinctCountMultipleViaJoin.json | 733 +++++++ .../testDistinctCountWithExpandSumType.json | 250 +++ .../testDistinctCountWithoutGroupBy.json | 302 +++ .../testDistinctNonDistinctAggregates.json | 426 ++++ ...nctNonDistinctAggregatesWithGrouping1.json | 404 ++++ ...nctNonDistinctAggregatesWithGrouping2.json | 305 +++ ...tNonDistinctTwoAggregatesWithGrouping.json | 368 ++++ ...istinctWithDiffFiltersAndSameGroupSet.json | 484 +++++ .../testDistinctWithFilterAndGroupBy.json | 566 +++++ .../testDistinctWithFilterWithoutGroupBy.json | 466 +++++ tests/calcite/testDistinctWithGrouping.json | 324 +++ .../testDistinctWithMultipleInputs.json | 400 ++++ ...tDistinctWithMultipleInputsAndGroupby.json | 406 ++++ tests/calcite/testEmptyAggregate.json | 73 + ...regateEmptyKeyWithAggregateValuesRule.json | 66 + .../calcite/testEmptyFilterProjectUnion.json | 121 ++ tests/calcite/testEmptyIntersect.json | 110 + tests/calcite/testEmptyMinus.json | 106 + tests/calcite/testEmptyMinus2.json | 197 ++ tests/calcite/testEmptyProject.json | 76 + tests/calcite/testEmptyProject2.json | 76 + tests/calcite/testEmptySort.json | 65 + tests/calcite/testEmptySort2.json | 20 + tests/calcite/testEmptySortLimitZero.json | 61 + .../testExistsWithAtLeastOneRowSubQuery.json | 136 ++ .../calcite/testExistsWithNoRowSubQuery.json | 57 + tests/calcite/testExpandFilterExists.json | 235 +++ .../calcite/testExpandFilterExistsSimple.json | 193 ++ .../testExpandFilterExistsSimpleAnd.json | 224 ++ tests/calcite/testExpandFilterIn.json | 271 +++ tests/calcite/testExpandFilterIn3Value.json | 639 ++++++ .../calcite/testExpandFilterInComposite.json | 215 ++ tests/calcite/testExpandFilterScalar.json | 370 ++++ tests/calcite/testExpandJoinExists.json | 223 ++ tests/calcite/testExpandJoinScalar.json | 402 ++++ tests/calcite/testExpandProjectExists.json | 163 ++ tests/calcite/testExpandProjectIn.json | 211 ++ .../calcite/testExpandProjectInComposite.json | 155 ++ .../calcite/testExpandProjectInNullable.json | 535 +++++ tests/calcite/testExpandProjectScalar.json | 161 ++ .../testExpandWhereComparisonCorrelated.json | 262 +++ .../testExpressionSimplification1.json | 127 ++ .../testExpressionSimplification2.json | 157 ++ tests/calcite/testExtractJoinFilterRule.json | 88 + .../calcite/testExtractYearMonthToRange.json | 149 ++ tests/calcite/testExtractYearToRange.json | 126 ++ .../testFilterJoinRuleAndIsNotNull.json | 206 ++ .../testFilterJoinRuleOrIsNotNull.json | 206 ++ tests/calcite/testFilterProjectTranspose.json | 315 +++ ...testFilterRemoveIsNotDistinctFromRule.json | 48 + ...estFlattenUncorrelatedCallBelowEquals.json | 442 ++++ ...elatedTwoLevelCallBelowEqualsSucceeds.json | 474 +++++ ...estFullOuterJoinSimplificationToInner.json | 220 ++ ...ullOuterJoinSimplificationToLeftOuter.json | 157 ++ ...llOuterJoinSimplificationToRightOuter.json | 181 ++ .../testGroupByBooleanLiteralSimple.json | 212 ++ .../calcite/testGroupByDateLiteralSimple.json | 212 ++ .../calcite/testGroupByMultipleLiterals.json | 432 ++++ ...dicatesWithNotOperatorInJoinCondition.json | 257 +++ tests/calcite/testIntersectToDistinct.json | 1840 +++++++++++++++++ ...eWithBottomAlwaysTrueConditionAllowed.json | 114 + ...RuleWithTopAlwaysTrueConditionAllowed.json | 94 + ...uteRuleWithAlwaysTrueConditionAllowed.json | 87 + tests/calcite/testJoinConditionPushdown1.json | 246 +++ tests/calcite/testJoinConditionPushdown2.json | 175 ++ tests/calcite/testJoinConditionPushdown4.json | 150 ++ tests/calcite/testJoinConditionPushdown6.json | 166 ++ .../testJoinDeriveIsNotNullFilterRule1.json | 94 + .../testJoinDeriveIsNotNullFilterRule12.json | 122 ++ .../testJoinDeriveIsNotNullFilterRule2.json | 170 ++ .../testJoinDeriveIsNotNullFilterRule3.json | 94 + .../testJoinDeriveIsNotNullFilterRule4.json | 144 ++ .../testJoinDeriveIsNotNullFilterRule5.json | 144 ++ tests/calcite/testJoinProjectTranspose1.json | 159 ++ tests/calcite/testJoinProjectTranspose7.json | 104 + tests/calcite/testJoinProjectTranspose8.json | 148 ++ .../testJoinProjectTransposeWindow.json | 172 ++ ...testJoinPushTransitivePredicatesRule2.json | 1424 +++++++++++++ tests/calcite/testLeftEmptyAntiJoin.json | 57 + tests/calcite/testLeftEmptyFullJoin.json | 181 ++ tests/calcite/testLeftEmptyInnerJoin.json | 162 ++ tests/calcite/testLeftEmptyLeftJoin.json | 162 ++ tests/calcite/testLeftEmptyRightJoin.json | 181 ++ tests/calcite/testLeftEmptySemiJoin.json | 57 + ...estLeftOuterJoinSimplificationToInner.json | 181 ++ ...ReuseDistinctAttrWithMixedOptionality.json | 244 +++ tests/calcite/testMergeFilter.json | 102 + tests/calcite/testMergeIntersect.json | 318 +++ tests/calcite/testMergeJoinFilter.json | 152 ++ tests/calcite/testMergeMinus.json | 324 +++ tests/calcite/testMergeUnionAll.json | 318 +++ tests/calcite/testMergeUnionDistinct.json | 324 +++ tests/calcite/testMergeUnionMixed2.json | 322 +++ ...ReuseDistinctAttrWithMixedOptionality.json | 244 +++ tests/calcite/testMinusMergeRule.json | 562 +++++ .../testMultipleDistinctWithGrouping.json | 619 ++++++ .../testNoOversimplificationBelowIsNull.json | 203 ++ tests/calcite/testOrAlwaysTrue.json | 217 ++ tests/calcite/testOrAlwaysTrue2.json | 217 ++ .../testOversimplifiedCaseStatement.json | 194 ++ tests/calcite/testProjectAggregateMerge.json | 231 +++ .../testProjectAggregateMergeSum0.json | 143 ++ .../testProjectAggregateMergeSum0AndSum.json | 182 ++ ...ctCorrelateTransposeRuleAntiCorrelate.json | 104 + ...ctCorrelateTransposeRuleLeftCorrelate.json | 281 +++ ...ctCorrelateTransposeRuleSemiCorrelate.json | 104 + ...jectFilterTransposeRuleOnEmptyRowType.json | 66 + tests/calcite/testProjectJoinRemove1.json | 102 + tests/calcite/testProjectJoinRemove10.json | 64 + tests/calcite/testProjectJoinRemove4.json | 58 + tests/calcite/testProjectJoinRemove7.json | 58 + .../calcite/testProjectJoinTransposeItem.json | 206 ++ tests/calcite/testProjectSetOpTranspose.json | 216 ++ .../testPullAggregateThroughUnion.json | 470 +++++ .../testPullAggregateThroughUnion2.json | 470 +++++ ...llAggregateThroughUnionAndAddProjects.json | 470 +++++ ...estPullAggregateThroughUnionWithAlias.json | 572 +++++ tests/calcite/testPullConstantIntoFilter.json | 215 ++ tests/calcite/testPullConstantIntoJoin.json | 243 +++ tests/calcite/testPullConstantIntoJoin2.json | 326 +++ .../calcite/testPullConstantIntoProject.json | 101 + ...stantIntoProjectWithIsNotDistinctFrom.json | 155 ++ ...toProjectWithIsNotDistinctFromForNull.json | 125 ++ ...tPullConstantThroughAggregateAllConst.json | 222 ++ ...llConstantThroughAggregateAllLiterals.json | 222 ++ ...lConstantThroughAggregateConstGroupBy.json | 218 ++ ...tPullConstantThroughAggregatePermuted.json | 304 +++ ...antThroughAggregatePermutedConstFirst.json | 186 ++ ...tThroughAggregatePermutedConstGroupBy.json | 202 ++ ...tantThroughAggregateSimpleNonNullable.json | 186 ++ .../testPullConstantThroughConstLast.json | 186 ++ .../calcite/testPullConstantThroughUnion.json | 91 + .../testPullConstantThroughUnion3.json | 81 + .../testPullFilterThroughAggregate.json | 248 +++ ...ullFilterThroughAggregateGroupingSets.json | 420 ++++ tests/calcite/testPullNull.json | 170 ++ ...ushAboveFiltersIntoInnerJoinCondition.json | 180 ++ ...testPushAggregateFunctionsThroughJoin.json | 443 ++++ .../calcite/testPushAggregateSumNoGroup.json | 370 ++++ .../testPushAggregateSumThroughJoin.json | 470 +++++ ...ateSumThroughJoinAfterAggregateReduce.json | 743 +++++++ ...ggregateSumWithoutGroupKeyThroughJoin.json | 675 ++++++ .../testPushAggregateThroughJoin1.json | 399 ++++ .../testPushAggregateThroughJoin2.json | 941 +++++++++ .../testPushAggregateThroughJoin4.json | 172 ++ .../testPushAggregateThroughJoin5.json | 199 ++ .../testPushAggregateThroughJoin6.json | 438 ++++ .../testPushAggregateThroughJoin7.json | 388 ++++ .../testPushAggregateThroughJoin8.json | 388 ++++ .../testPushAggregateThroughJoinDistinct.json | 314 +++ ...regateThroughJoinOnEmptyLogicalValues.json | 433 ++++ ...shAggregateThroughJoinWithUniqueInput.json | 774 +++++++ .../testPushAggregateThroughOuterJoin1.json | 641 ++++++ .../testPushAggregateThroughOuterJoin12.json | 615 ++++++ .../testPushAggregateThroughOuterJoin13.json | 615 ++++++ .../testPushAggregateThroughOuterJoin14.json | 390 ++++ .../testPushAggregateThroughOuterJoin15.json | 686 ++++++ .../testPushAggregateThroughOuterJoin16.json | 915 ++++++++ .../testPushAggregateThroughOuterJoin2.json | 634 ++++++ .../testPushAggregateThroughOuterJoin3.json | 686 ++++++ .../testPushAggregateThroughOuterJoin4.json | 394 ++++ .../testPushAggregateThroughOuterJoin5.json | 615 ++++++ .../testPushAggregateThroughOuterJoin6.json | 399 ++++ .../testPushAggregateThroughOuterJoin7.json | 915 ++++++++ .../testPushAggregateThroughOuterJoin8.json | 915 ++++++++ .../testPushAggregateThroughOuterJoin9.json | 941 +++++++++ .../testPushAvgGroupingSetsThroughUnion.json | 364 ++++ tests/calcite/testPushAvgThroughUnion.json | 320 +++ .../testPushBoolAndBoolOrThroughUnion.json | 692 +++++++ .../testPushCountFilterThroughUnion.json | 809 ++++++++ ...CountNullableGroupingSetsThroughUnion.json | 660 ++++++ .../testPushCountNullableThroughUnion.json | 552 +++++ ...PushCountStarGroupingSetsThroughUnion.json | 615 ++++++ .../testPushCountStarThroughUnion.json | 507 +++++ tests/calcite/testPushFilterPastAgg.json | 206 ++ tests/calcite/testPushFilterPastAggFour.json | 442 ++++ tests/calcite/testPushFilterPastAggTwo.json | 325 +++ ...estPushFilterPastAggWithGroupingSets2.json | 250 +++ tests/calcite/testPushFilterPastProject.json | 246 +++ tests/calcite/testPushFilterSemijoin.json | 108 + .../testPushFilterThroughSemiJoin.json | 131 ++ ...shFilterWithIsNotDistinctFromPastJoin.json | 227 ++ .../testPushJoinCondDownToProject.json | 211 ++ .../testPushJoinThroughUnionOnLeft.json | 207 ++ .../testPushJoinThroughUnionOnRight.json | 207 ++ ...shMaxNullableGroupingSetsThroughUnion.json | 660 ++++++ .../testPushMaxNullableThroughUnion.json | 552 +++++ .../testPushMinGroupingSetsThroughUnion.json | 660 ++++++ tests/calcite/testPushMinThroughUnion.json | 552 +++++ tests/calcite/testPushProjectPastFilter.json | 150 ++ tests/calcite/testPushProjectPastFilter2.json | 218 ++ .../calcite/testPushProjectPastFilter3b.json | 204 ++ .../calcite/testPushProjectPastFilter3c.json | 201 ++ .../calcite/testPushProjectPastFullJoin.json | 393 ++++ .../testPushProjectPastFullJoinStrong.json | 383 ++++ .../calcite/testPushProjectPastInnerJoin.json | 387 ++++ .../testPushProjectPastInnerJoinStrong.json | 383 ++++ tests/calcite/testPushProjectPastJoin.json | 146 ++ .../calcite/testPushProjectPastLeftJoin.json | 387 ++++ .../testPushProjectPastLeftJoinSwap.json | 393 ++++ ...testPushProjectPastLeftJoinSwapStrong.json | 383 ++++ .../calcite/testPushProjectPastRightJoin.json | 393 ++++ .../testPushProjectPastRightJoinStrong.json | 383 ++++ .../testPushProjectPastRightJoinSwap.json | 387 ++++ ...estPushProjectPastRightJoinSwapStrong.json | 383 ++++ tests/calcite/testPushProjectPastSetOp.json | 176 ++ ...hProjectWithIsNotDistinctFromPastJoin.json | 284 +++ .../testPushProjectWithOverPastJoin1.json | 156 ++ .../testPushProjectWithOverPastJoin2.json | 156 ++ .../testPushProjectWithOverPastJoin3.json | 171 ++ tests/calcite/testPushSemiJoinConditions.json | 193 ++ tests/calcite/testPushSemiJoinPastFilter.json | 136 ++ .../testPushSemiJoinPastJoinRuleLeft.json | 170 ++ .../testPushSemiJoinPastJoinRuleRight.json | 170 ++ .../calcite/testPushSemiJoinPastProject.json | 197 ++ ...shSumConstantGroupingSetsThroughUnion.json | 684 ++++++ .../testPushSumConstantThroughUnion.json | 576 ++++++ ...hSumCountStarGroupingSetsThroughUnion.json | 807 ++++++++ .../testPushSumCountStarThroughUnion.json | 729 +++++++ ...mNullConstantGroupingSetsThroughUnion.json | 684 ++++++ .../testPushSumNullConstantThroughUnion.json | 576 ++++++ ...shSumNullableGroupingSetsThroughUnion.json | 660 ++++++ .../testPushSumNullableNOGBYThroughUnion.json | 444 ++++ .../testPushSumNullableThroughUnion.json | 552 +++++ .../testReduceAggregateFunctionsByGroup.json | 268 +++ .../testReduceAllAggregateFunctions.json | 479 +++++ tests/calcite/testReduceAverage.json | 206 ++ ...AverageAndSumWithNoReduceStddevAndVar.json | 224 ++ ...ReduceAverageAndVarWithNoReduceStddev.json | 298 +++ .../testReduceAverageWithNoReduceSum.json | 206 ++ tests/calcite/testReduceCase.json | 46 + .../testReduceCaseNullabilityChange.json | 88 + tests/calcite/testReduceCastAndConsts.json | 140 ++ tests/calcite/testReduceCasts.json | 325 +++ .../testReduceCompositeInSubQuery.json | 322 +++ tests/calcite/testReduceConstants.json | 340 +++ tests/calcite/testReduceConstants3.json | 131 ++ .../testReduceConstantsCaseEquals.json | 248 +++ .../testReduceConstantsCaseEquals2.json | 248 +++ .../testReduceConstantsCaseEquals3.json | 308 +++ tests/calcite/testReduceConstantsDup.json | 66 + tests/calcite/testReduceConstantsDup2.json | 145 ++ tests/calcite/testReduceConstantsDup3.json | 63 + .../calcite/testReduceConstantsDup3Null.json | 75 + tests/calcite/testReduceConstantsDupNot.json | 67 + tests/calcite/testReduceConstantsDupNot2.json | 78 + .../testReduceConstantsDupNot2Null.json | 105 + .../testReduceConstantsDupNotNull.json | 79 + .../testReduceConstantsEliminatesFilter.json | 78 + .../calcite/testReduceConstantsIsNotNull.json | 75 + tests/calcite/testReduceConstantsIsNull.json | 62 + tests/calcite/testReduceConstantsNegated.json | 70 + .../testReduceConstantsNegatedInverted.json | 66 + tests/calcite/testReduceConstantsNull.json | 101 + .../testReduceConstantsNullEqualsOne.json | 154 ++ .../testReduceConstantsProjectNullable.json | 69 + .../testReduceConstantsRequiresExecutor.json | 78 + tests/calcite/testReduceDynamic.json | 34 + tests/calcite/testReduceNestedCaseWhen.json | 126 ++ .../calcite/testReduceNullableToNotNull.json | 68 + .../calcite/testReduceNullableToNotNull2.json | 68 + tests/calcite/testReduceOrCaseWhen.json | 111 + tests/calcite/testReduceValuesToEmpty.json | 75 + .../calcite/testReduceValuesUnderFilter.json | 77 + .../calcite/testReduceValuesUnderProject.json | 54 + .../testReduceValuesUnderProjectFilter.json | 107 + .../testReduceWithNonTypePredicate.json | 207 ++ tests/calcite/testRemoveDistinctOnAgg.json | 208 ++ tests/calcite/testRemoveSemiJoin.json | 86 + tests/calcite/testRemoveSemiJoinRight.json | 132 ++ .../testRemoveSemiJoinRightWithFilter.json | 159 ++ .../calcite/testRemoveSemiJoinWithFilter.json | 117 ++ tests/calcite/testRightEmptyAntiJoin.json | 54 + .../testRightEmptyAntiJoinNonEqui.json | 69 + tests/calcite/testRightEmptyFullJoin.json | 160 ++ tests/calcite/testRightEmptyInnerJoin.json | 141 ++ tests/calcite/testRightEmptyLeftJoin.json | 160 ++ tests/calcite/testRightEmptyRightJoin.json | 141 ++ tests/calcite/testRightEmptySemiJoin.json | 57 + ...stRightOuterJoinSimplificationToInner.json | 157 ++ .../calcite/testSemiJoinProjectTranspose.json | 236 +++ .../calcite/testSemiJoinReduceConstants.json | 195 ++ tests/calcite/testSemiJoinRule.json | 182 ++ tests/calcite/testSemiJoinRuleExists.json | 182 ++ tests/calcite/testSemiJoinRuleLeft.json | 144 ++ tests/calcite/testSemiJoinRuleWithHint.json | 139 ++ ...testSemiJoinRuleWithJoinOnUniqueInput.json | 109 + tests/calcite/testSemiJoinTrim.json | 201 ++ tests/calcite/testSimplifyFilter.json | 223 ++ .../testSkipReduceConstantsCaseEquals.json | 257 +++ tests/calcite/testSome.json | 355 ++++ tests/calcite/testSomeWithEquality.json | 169 ++ tests/calcite/testSomeWithEquality2.json | 215 ++ tests/calcite/testSomeWithNotEquality.json | 400 ++++ .../testSortJoinCopyInnerJoinOrderBy.json | 152 ++ ...testSortJoinCopyInnerJoinOrderByLimit.json | 184 ++ ...SortJoinCopyInnerJoinOrderByTwoFields.json | 157 ++ .../testSortJoinCopySemiJoinOrderBy.json | 92 + ...ortJoinCopySemiJoinOrderByLimitOffset.json | 112 + ...testSortJoinCopySemiJoinOrderByOffset.json | 102 + tests/calcite/testSortJoinTranspose1.json | 189 ++ tests/calcite/testSortJoinTranspose2.json | 174 ++ tests/calcite/testSortJoinTranspose4.json | 174 ++ tests/calcite/testSortJoinTranspose6.json | 128 ++ tests/calcite/testSortProjectTranspose1.json | 58 + tests/calcite/testSortProjectTranspose2.json | 66 + .../testSortRemovalAllKeysConstant.json | 265 +++ .../testSortRemovalOneKeyConstant.json | 276 +++ tests/calcite/testSortUnionTranspose.json | 104 + tests/calcite/testSortUnionTranspose2.json | 84 + tests/calcite/testSortUnionTranspose3.json | 104 + tests/calcite/testSpatialContainsPoint.json | 133 ++ tests/calcite/testSpatialDWithinLine.json | 149 ++ tests/calcite/testSpatialDWithinReversed.json | 133 ++ .../calcite/testSpatialDWithinToHilbert.json | 133 ++ .../testSpatialDWithinToHilbertNegative.json | 94 + .../testSpatialDWithinToHilbertZero.json | 129 ++ tests/calcite/testSpatialReduce.json | 58 + tests/calcite/testStrengthenJoinType.json | 250 +++ ...estSumAndDistinctSumWithExpandSumType.json | 259 +++ tests/calcite/testSwapOuterJoin.json | 117 ++ .../testTransitiveInferenceAggregate.json | 272 +++ ...stTransitiveInferenceComplexPredicate.json | 228 ++ ...stTransitiveInferenceConjunctInPullUp.json | 120 ++ .../calcite/testTransitiveInferenceJoin.json | 120 ++ .../testTransitiveInferenceJoin3way.json | 174 ++ .../testTransitiveInferenceJoin3wayAgg.json | 326 +++ .../testTransitiveInferenceLeftOuterJoin.json | 152 ++ .../testTransitiveInferenceProject.json | 184 ++ ...estTransitiveInferencePullUpThruAlias.json | 136 ++ ...testTransitiveInferenceRightOuterJoin.json | 152 ++ .../calcite/testTransitiveInferenceUnion.json | 192 ++ .../testTransitiveInferenceUnion3way.json | 248 +++ ...estTransitiveInferenceUnionAlwaysTrue.json | 212 ++ ...IsFlattenedOnlyIfSiblingOfCorrelation.json | 534 +++++ tests/calcite/testUnionMergeRule.json | 483 +++++ tests/calcite/testUnionToDistinctRule.json | 147 ++ .../testWhereAnyCorrelatedInSelect.json | 423 ++++ .../testWhereExpressionInCorrelated.json | 244 +++ .../testWhereExpressionInCorrelated2.json | 251 +++ tests/calcite/testWhereInCorrelated.json | 121 ++ tests/calcite/testWhereInJoinCorrelated.json | 256 +++ tests/calcite/testWhereNotInCorrelated.json | 267 +++ tests/calcite/testWhereNotInCorrelated2.json | 427 ++++ tests/calcite/testWhereOrSubQuery.json | 219 ++ tests/calcite/testWithinDistinct.json | 556 +++++ .../testWithinDistinctCountDistinct.json | 679 ++++++ .../testWithinDistinctFilteredAggs.json | 1167 +++++++++++ ...tWithinDistinctFilteredAggsSameFilter.json | 1089 ++++++++++ ...stinctFilteredAggsUniformDistinctKeys.json | 963 +++++++++ ...ilteredAggsUniformDistinctKeysNoThrow.json | 691 +++++++ tests/calcite/testWithinDistinctNoThrow.json | 464 +++++ ...testWithinDistinctUniformDistinctKeys.json | 535 +++++ ...hinDistinctUniformDistinctKeysNoThrow.json | 399 ++++ 831 files changed, 119010 insertions(+), 415 deletions(-) delete mode 100644 tests/benchmark/testAddRedundantSemiJoinRule.json delete mode 100644 tests/benchmark/testAggregateCaseToFilter.json delete mode 100644 tests/benchmark/testAggregateConstantKeyRule.json delete mode 100644 tests/benchmark/testAggregateConstantKeyRule3.json delete mode 100644 tests/benchmark/testAggregateDynamicFunction.json delete mode 100644 tests/benchmark/testAggregateExtractProjectRule.json delete mode 100644 tests/benchmark/testAggregateExtractProjectRuleWithGroupingSets.json delete mode 100644 tests/benchmark/testAggregateExtractProjectRuleWithGroupingSets2.json delete mode 100644 tests/benchmark/testAggregateGroupingSetsProjectMerge.json delete mode 100644 tests/benchmark/testAggregateJoinRemove1.json delete mode 100644 tests/benchmark/testAggregateJoinRemove10.json delete mode 100644 tests/benchmark/testAggregateJoinRemove11.json delete mode 100644 tests/benchmark/testAggregateJoinRemove2.json delete mode 100644 tests/benchmark/testAggregateJoinRemove3.json delete mode 100644 tests/benchmark/testAggregateJoinRemove4.json delete mode 100644 tests/benchmark/testAggregateJoinRemove5.json delete mode 100644 tests/benchmark/testAggregateJoinRemove6.json delete mode 100644 tests/benchmark/testAggregateJoinRemove7.json delete mode 100644 tests/benchmark/testAggregateJoinRemove8.json delete mode 100644 tests/benchmark/testAggregateJoinRemove9.json delete mode 100644 tests/benchmark/testAggregateMerge1.json delete mode 100644 tests/benchmark/testAggregateMerge2.json delete mode 100644 tests/benchmark/testAggregateMerge8.json delete mode 100644 tests/benchmark/testAggregateMergeSum0.json delete mode 100644 tests/benchmark/testAggregateProjectMerge.json delete mode 100644 tests/benchmark/testAggregateProjectPullUpConstants.json delete mode 100644 tests/benchmark/testAggregateProjectPullUpConstants2.json delete mode 100644 tests/benchmark/testAggregateRemove1.json delete mode 100644 tests/benchmark/testAggregateRemove2.json delete mode 100644 tests/benchmark/testAggregateRemove3.json delete mode 100644 tests/benchmark/testAggregateRemove7.json delete mode 100644 tests/benchmark/testAggregateUnionTransposeWithOneInputUnique.json delete mode 100644 tests/benchmark/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json delete mode 100644 tests/benchmark/testAll.json delete mode 100644 tests/benchmark/testAlreadyFalseEliminatesFilter.json delete mode 100644 tests/benchmark/testAntiJoinProjectTranspose.json delete mode 100644 tests/benchmark/testAnyInProjectNonNullable.json delete mode 100644 tests/benchmark/testAnyInProjectNullable.json delete mode 100644 tests/benchmark/testBitAndReuseDistinctAttrWithMixedOptionality.json delete mode 100644 tests/benchmark/testBitOrReuseDistinctAttrWithMixedOptionality.json delete mode 100644 tests/benchmark/testCasePushIsAlwaysWorking.json delete mode 100644 tests/benchmark/testCastInAggregateExpandDistinctAggregatesRule.json delete mode 100644 tests/benchmark/testCastInAggregateReduceFunctions.json delete mode 100644 tests/benchmark/testCustomColumnResolvingInCorrelatedSubQuery.json delete mode 100644 tests/benchmark/testCustomColumnResolvingInCorrelatedSubQuery2.json delete mode 100644 tests/benchmark/testCustomColumnResolvingInNonCorrelatedSubQuery.json delete mode 100644 tests/benchmark/testDecorrelateAggWithConstantGroupKey.json delete mode 100644 tests/benchmark/testDecorrelateExists.json delete mode 100644 tests/benchmark/testDecorrelateTwoExists.json delete mode 100644 tests/benchmark/testDecorrelateTwoIn.json delete mode 100644 tests/benchmark/testDecorrelateUncorrelatedInAndCorrelatedExists.json delete mode 100644 tests/benchmark/testDigestOfApproximateDistinctAggregateCall.json delete mode 100644 tests/benchmark/testDistinctCount1.json delete mode 100644 tests/benchmark/testDistinctCount2.json delete mode 100644 tests/benchmark/testDistinctCount3.json delete mode 100644 tests/benchmark/testDistinctCountGroupingSets1.json delete mode 100644 tests/benchmark/testDistinctCountGroupingSets2.json delete mode 100644 tests/benchmark/testDistinctCountMixed.json delete mode 100644 tests/benchmark/testDistinctCountMixed2.json delete mode 100644 tests/benchmark/testDistinctCountMixedJoin.json delete mode 100644 tests/benchmark/testDistinctCountMultiple.json delete mode 100644 tests/benchmark/testDistinctCountMultipleNoGroup.json delete mode 100644 tests/benchmark/testDistinctCountMultipleViaJoin.json delete mode 100644 tests/benchmark/testDistinctCountWithExpandSumType.json delete mode 100644 tests/benchmark/testDistinctCountWithoutGroupBy.json delete mode 100644 tests/benchmark/testDistinctNonDistinctAggregates.json delete mode 100644 tests/benchmark/testDistinctNonDistinctAggregatesWithGrouping1.json delete mode 100644 tests/benchmark/testDistinctNonDistinctAggregatesWithGrouping2.json delete mode 100644 tests/benchmark/testDistinctNonDistinctTwoAggregatesWithGrouping.json delete mode 100644 tests/benchmark/testDistinctWithDiffFiltersAndSameGroupSet.json delete mode 100644 tests/benchmark/testDistinctWithFilterAndGroupBy.json delete mode 100644 tests/benchmark/testDistinctWithFilterWithoutGroupBy.json delete mode 100644 tests/benchmark/testDistinctWithGrouping.json delete mode 100644 tests/benchmark/testDistinctWithMultipleInputs.json delete mode 100644 tests/benchmark/testDistinctWithMultipleInputsAndGroupby.json delete mode 100644 tests/benchmark/testEmptyAggregate.json delete mode 100644 tests/benchmark/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json delete mode 100644 tests/benchmark/testEmptyFilterProjectUnion.json delete mode 100644 tests/benchmark/testEmptyIntersect.json delete mode 100644 tests/benchmark/testEmptyMinus.json delete mode 100644 tests/benchmark/testEmptyMinus2.json delete mode 100644 tests/benchmark/testEmptyProject.json delete mode 100644 tests/benchmark/testEmptyProject2.json delete mode 100644 tests/benchmark/testEmptySort.json delete mode 100644 tests/benchmark/testEmptySort2.json delete mode 100644 tests/benchmark/testEmptySortLimitZero.json delete mode 100644 tests/benchmark/testExistsWithAtLeastOneRowSubQuery.json delete mode 100644 tests/benchmark/testExistsWithNoRowSubQuery.json delete mode 100644 tests/benchmark/testExpandFilterExists.json delete mode 100644 tests/benchmark/testExpandFilterExistsSimple.json delete mode 100644 tests/benchmark/testExpandFilterExistsSimpleAnd.json delete mode 100644 tests/benchmark/testExpandFilterIn.json delete mode 100644 tests/benchmark/testExpandFilterIn3Value.json delete mode 100644 tests/benchmark/testExpandFilterInComposite.json delete mode 100644 tests/benchmark/testExpandFilterScalar.json delete mode 100644 tests/benchmark/testExpandJoinExists.json delete mode 100644 tests/benchmark/testExpandJoinScalar.json delete mode 100644 tests/benchmark/testExpandProjectExists.json delete mode 100644 tests/benchmark/testExpandProjectIn.json delete mode 100644 tests/benchmark/testExpandProjectInComposite.json delete mode 100644 tests/benchmark/testExpandProjectInNullable.json delete mode 100644 tests/benchmark/testExpandProjectScalar.json delete mode 100644 tests/benchmark/testExpandWhereComparisonCorrelated.json delete mode 100644 tests/benchmark/testExpressionSimplification1.json delete mode 100644 tests/benchmark/testExpressionSimplification2.json delete mode 100644 tests/benchmark/testExtractJoinFilterRule.json delete mode 100644 tests/benchmark/testExtractYearMonthToRange.json delete mode 100644 tests/benchmark/testExtractYearToRange.json delete mode 100644 tests/benchmark/testFilterJoinRuleAndIsNotNull.json delete mode 100644 tests/benchmark/testFilterJoinRuleOrIsNotNull.json delete mode 100644 tests/benchmark/testFilterProjectTranspose.json delete mode 100644 tests/benchmark/testFilterRemoveIsNotDistinctFromRule.json delete mode 100644 tests/benchmark/testFlattenUncorrelatedCallBelowEquals.json delete mode 100644 tests/benchmark/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json delete mode 100644 tests/benchmark/testFullOuterJoinSimplificationToInner.json delete mode 100644 tests/benchmark/testFullOuterJoinSimplificationToLeftOuter.json delete mode 100644 tests/benchmark/testFullOuterJoinSimplificationToRightOuter.json delete mode 100644 tests/benchmark/testGroupByBooleanLiteralSimple.json delete mode 100644 tests/benchmark/testGroupByDateLiteralSimple.json delete mode 100644 tests/benchmark/testGroupByMultipleLiterals.json delete mode 100644 tests/benchmark/testInferringPredicatesWithNotOperatorInJoinCondition.json delete mode 100644 tests/benchmark/testIntersectToDistinct.json delete mode 100644 tests/benchmark/testIsNullPushDown.json delete mode 100644 tests/benchmark/testIsNullPushDown2.json delete mode 100644 tests/benchmark/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json delete mode 100644 tests/benchmark/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json delete mode 100644 tests/benchmark/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json delete mode 100644 tests/benchmark/testJoinConditionPushdown1.json delete mode 100644 tests/benchmark/testJoinConditionPushdown2.json delete mode 100644 tests/benchmark/testJoinConditionPushdown4.json delete mode 100644 tests/benchmark/testJoinConditionPushdown6.json delete mode 100644 tests/benchmark/testJoinDeriveIsNotNullFilterRule1.json delete mode 100644 tests/benchmark/testJoinDeriveIsNotNullFilterRule12.json delete mode 100644 tests/benchmark/testJoinDeriveIsNotNullFilterRule2.json delete mode 100644 tests/benchmark/testJoinDeriveIsNotNullFilterRule3.json delete mode 100644 tests/benchmark/testJoinDeriveIsNotNullFilterRule4.json delete mode 100644 tests/benchmark/testJoinDeriveIsNotNullFilterRule5.json delete mode 100644 tests/benchmark/testJoinProjectTranspose1.json delete mode 100644 tests/benchmark/testJoinProjectTranspose7.json delete mode 100644 tests/benchmark/testJoinProjectTranspose8.json delete mode 100644 tests/benchmark/testJoinProjectTransposeWindow.json delete mode 100644 tests/benchmark/testJoinPushTransitivePredicatesRule2.json delete mode 100644 tests/benchmark/testLeftEmptyAntiJoin.json delete mode 100644 tests/benchmark/testLeftEmptyFullJoin.json delete mode 100644 tests/benchmark/testLeftEmptyInnerJoin.json delete mode 100644 tests/benchmark/testLeftEmptyLeftJoin.json delete mode 100644 tests/benchmark/testLeftEmptyRightJoin.json delete mode 100644 tests/benchmark/testLeftEmptySemiJoin.json delete mode 100644 tests/benchmark/testLeftOuterJoinSimplificationToInner.json delete mode 100644 tests/benchmark/testMaxReuseDistinctAttrWithMixedOptionality.json delete mode 100644 tests/benchmark/testMergeFilter.json delete mode 100644 tests/benchmark/testMergeIntersect.json delete mode 100644 tests/benchmark/testMergeJoinFilter.json delete mode 100644 tests/benchmark/testMergeMinus.json delete mode 100644 tests/benchmark/testMergeUnionAll.json delete mode 100644 tests/benchmark/testMergeUnionDistinct.json delete mode 100644 tests/benchmark/testMergeUnionMixed2.json delete mode 100644 tests/benchmark/testMinReuseDistinctAttrWithMixedOptionality.json delete mode 100644 tests/benchmark/testMinusMergeRule.json delete mode 100644 tests/benchmark/testMultipleDistinctWithGrouping.json delete mode 100644 tests/benchmark/testNoOversimplificationBelowIsNull.json delete mode 100644 tests/benchmark/testOrAlwaysTrue.json delete mode 100644 tests/benchmark/testOrAlwaysTrue2.json delete mode 100644 tests/benchmark/testOversimplifiedCaseStatement.json delete mode 100644 tests/benchmark/testProjectAggregateMerge.json delete mode 100644 tests/benchmark/testProjectAggregateMergeSum0.json delete mode 100644 tests/benchmark/testProjectAggregateMergeSum0AndSum.json delete mode 100644 tests/benchmark/testProjectCorrelateTransposeRuleLeftCorrelate.json delete mode 100644 tests/benchmark/testProjectJoinRemove1.json delete mode 100644 tests/benchmark/testProjectJoinRemove10.json delete mode 100644 tests/benchmark/testProjectJoinRemove4.json delete mode 100644 tests/benchmark/testProjectJoinRemove7.json delete mode 100644 tests/benchmark/testProjectJoinTransposeItem.json delete mode 100644 tests/benchmark/testProjectSetOpTranspose.json delete mode 100644 tests/benchmark/testPullAggregateThroughUnion.json delete mode 100644 tests/benchmark/testPullAggregateThroughUnion2.json delete mode 100644 tests/benchmark/testPullAggregateThroughUnionAndAddProjects.json delete mode 100644 tests/benchmark/testPullAggregateThroughUnionWithAlias.json delete mode 100644 tests/benchmark/testPullConstantIntoFilter.json delete mode 100644 tests/benchmark/testPullConstantIntoJoin.json delete mode 100644 tests/benchmark/testPullConstantIntoJoin2.json delete mode 100644 tests/benchmark/testPullConstantIntoProject.json delete mode 100644 tests/benchmark/testPullConstantIntoProjectWithIsNotDistinctFrom.json delete mode 100644 tests/benchmark/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json delete mode 100644 tests/benchmark/testPullConstantThroughAggregateAllConst.json delete mode 100644 tests/benchmark/testPullConstantThroughAggregateAllLiterals.json delete mode 100644 tests/benchmark/testPullConstantThroughAggregateConstGroupBy.json delete mode 100644 tests/benchmark/testPullConstantThroughAggregatePermuted.json delete mode 100644 tests/benchmark/testPullConstantThroughAggregatePermutedConstFirst.json delete mode 100644 tests/benchmark/testPullConstantThroughAggregatePermutedConstGroupBy.json delete mode 100644 tests/benchmark/testPullConstantThroughAggregateSimpleNonNullable.json delete mode 100644 tests/benchmark/testPullConstantThroughConstLast.json delete mode 100644 tests/benchmark/testPullConstantThroughUnion.json delete mode 100644 tests/benchmark/testPullConstantThroughUnion3.json delete mode 100644 tests/benchmark/testPullFilterThroughAggregate.json delete mode 100644 tests/benchmark/testPullFilterThroughAggregateGroupingSets.json delete mode 100644 tests/benchmark/testPullNull.json delete mode 100644 tests/benchmark/testPushAboveFiltersIntoInnerJoinCondition.json delete mode 100644 tests/benchmark/testPushAggregateFunctionsThroughJoin.json delete mode 100644 tests/benchmark/testPushAggregateSumNoGroup.json delete mode 100644 tests/benchmark/testPushAggregateSumThroughJoin.json delete mode 100644 tests/benchmark/testPushAggregateSumThroughJoinAfterAggregateReduce.json delete mode 100644 tests/benchmark/testPushAggregateSumWithoutGroupKeyThroughJoin.json delete mode 100644 tests/benchmark/testPushAggregateThroughJoin1.json delete mode 100644 tests/benchmark/testPushAggregateThroughJoin2.json delete mode 100644 tests/benchmark/testPushAggregateThroughJoin4.json delete mode 100644 tests/benchmark/testPushAggregateThroughJoin5.json delete mode 100644 tests/benchmark/testPushAggregateThroughJoin6.json delete mode 100644 tests/benchmark/testPushAggregateThroughJoin7.json delete mode 100644 tests/benchmark/testPushAggregateThroughJoin8.json delete mode 100644 tests/benchmark/testPushAggregateThroughJoinDistinct.json delete mode 100644 tests/benchmark/testPushAggregateThroughJoinOnEmptyLogicalValues.json delete mode 100644 tests/benchmark/testPushAggregateThroughJoinWithUniqueInput.json delete mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin1.json delete mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin12.json delete mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin13.json delete mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin14.json delete mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin15.json delete mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin16.json delete mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin2.json delete mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin3.json delete mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin4.json delete mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin5.json delete mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin6.json delete mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin7.json delete mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin8.json delete mode 100644 tests/benchmark/testPushAggregateThroughOuterJoin9.json delete mode 100644 tests/benchmark/testPushAvgGroupingSetsThroughUnion.json delete mode 100644 tests/benchmark/testPushAvgThroughUnion.json delete mode 100644 tests/benchmark/testPushBoolAndBoolOrThroughUnion.json delete mode 100644 tests/benchmark/testPushCountFilterThroughUnion.json delete mode 100644 tests/benchmark/testPushCountNullableGroupingSetsThroughUnion.json delete mode 100644 tests/benchmark/testPushCountNullableThroughUnion.json delete mode 100644 tests/benchmark/testPushCountStarGroupingSetsThroughUnion.json delete mode 100644 tests/benchmark/testPushCountStarThroughUnion.json delete mode 100644 tests/benchmark/testPushFilterPastAgg.json delete mode 100644 tests/benchmark/testPushFilterPastAggFour.json delete mode 100644 tests/benchmark/testPushFilterPastAggTwo.json delete mode 100644 tests/benchmark/testPushFilterPastAggWithGroupingSets2.json delete mode 100644 tests/benchmark/testPushFilterPastProject.json delete mode 100644 tests/benchmark/testPushFilterSemijoin.json delete mode 100644 tests/benchmark/testPushFilterThroughSemiJoin.json delete mode 100644 tests/benchmark/testPushFilterWithIsNotDistinctFromPastJoin.json delete mode 100644 tests/benchmark/testPushJoinCondDownToProject.json delete mode 100644 tests/benchmark/testPushJoinThroughUnionOnLeft.json delete mode 100644 tests/benchmark/testPushJoinThroughUnionOnRight.json delete mode 100644 tests/benchmark/testPushMaxNullableGroupingSetsThroughUnion.json delete mode 100644 tests/benchmark/testPushMaxNullableThroughUnion.json delete mode 100644 tests/benchmark/testPushMinGroupingSetsThroughUnion.json delete mode 100644 tests/benchmark/testPushMinThroughUnion.json delete mode 100644 tests/benchmark/testPushProjectPastFilter.json delete mode 100644 tests/benchmark/testPushProjectPastFilter2.json delete mode 100644 tests/benchmark/testPushProjectPastFilter3b.json delete mode 100644 tests/benchmark/testPushProjectPastFilter3c.json delete mode 100644 tests/benchmark/testPushProjectPastFullJoin.json delete mode 100644 tests/benchmark/testPushProjectPastFullJoinStrong.json delete mode 100644 tests/benchmark/testPushProjectPastInnerJoin.json delete mode 100644 tests/benchmark/testPushProjectPastInnerJoinStrong.json delete mode 100644 tests/benchmark/testPushProjectPastJoin.json delete mode 100644 tests/benchmark/testPushProjectPastLeftJoin.json delete mode 100644 tests/benchmark/testPushProjectPastLeftJoinSwap.json delete mode 100644 tests/benchmark/testPushProjectPastLeftJoinSwapStrong.json delete mode 100644 tests/benchmark/testPushProjectPastRightJoin.json delete mode 100644 tests/benchmark/testPushProjectPastRightJoinStrong.json delete mode 100644 tests/benchmark/testPushProjectPastRightJoinSwap.json delete mode 100644 tests/benchmark/testPushProjectPastRightJoinSwapStrong.json delete mode 100644 tests/benchmark/testPushProjectPastSetOp.json delete mode 100644 tests/benchmark/testPushProjectWithIsNotDistinctFromPastJoin.json delete mode 100644 tests/benchmark/testPushProjectWithOverPastJoin1.json delete mode 100644 tests/benchmark/testPushProjectWithOverPastJoin2.json delete mode 100644 tests/benchmark/testPushProjectWithOverPastJoin3.json delete mode 100644 tests/benchmark/testPushSemiJoinConditions.json delete mode 100644 tests/benchmark/testPushSemiJoinPastFilter.json delete mode 100644 tests/benchmark/testPushSemiJoinPastJoinRuleLeft.json delete mode 100644 tests/benchmark/testPushSemiJoinPastJoinRuleRight.json delete mode 100644 tests/benchmark/testPushSemiJoinPastProject.json delete mode 100644 tests/benchmark/testPushSumConstantGroupingSetsThroughUnion.json delete mode 100644 tests/benchmark/testPushSumConstantThroughUnion.json delete mode 100644 tests/benchmark/testPushSumCountStarGroupingSetsThroughUnion.json delete mode 100644 tests/benchmark/testPushSumCountStarThroughUnion.json delete mode 100644 tests/benchmark/testPushSumNullConstantGroupingSetsThroughUnion.json delete mode 100644 tests/benchmark/testPushSumNullConstantThroughUnion.json delete mode 100644 tests/benchmark/testPushSumNullableGroupingSetsThroughUnion.json delete mode 100644 tests/benchmark/testPushSumNullableNOGBYThroughUnion.json delete mode 100644 tests/benchmark/testPushSumNullableThroughUnion.json delete mode 100644 tests/benchmark/testReduceAggregateFunctionsByGroup.json delete mode 100644 tests/benchmark/testReduceAllAggregateFunctions.json delete mode 100644 tests/benchmark/testReduceAverage.json delete mode 100644 tests/benchmark/testReduceAverageAndSumWithNoReduceStddevAndVar.json delete mode 100644 tests/benchmark/testReduceAverageAndVarWithNoReduceStddev.json delete mode 100644 tests/benchmark/testReduceAverageWithNoReduceSum.json delete mode 100644 tests/benchmark/testReduceCase.json delete mode 100644 tests/benchmark/testReduceCaseNullabilityChange.json delete mode 100644 tests/benchmark/testReduceCastAndConsts.json delete mode 100644 tests/benchmark/testReduceCasts.json delete mode 100644 tests/benchmark/testReduceCompositeInSubQuery.json delete mode 100644 tests/benchmark/testReduceConstants.json delete mode 100644 tests/benchmark/testReduceConstants3.json delete mode 100644 tests/benchmark/testReduceConstantsCaseEquals.json delete mode 100644 tests/benchmark/testReduceConstantsCaseEquals2.json delete mode 100644 tests/benchmark/testReduceConstantsCaseEquals3.json delete mode 100644 tests/benchmark/testReduceConstantsDup.json delete mode 100644 tests/benchmark/testReduceConstantsDup2.json delete mode 100644 tests/benchmark/testReduceConstantsDup3.json delete mode 100644 tests/benchmark/testReduceConstantsDup3Null.json delete mode 100644 tests/benchmark/testReduceConstantsDupNot.json delete mode 100644 tests/benchmark/testReduceConstantsDupNot2.json delete mode 100644 tests/benchmark/testReduceConstantsDupNot2Null.json delete mode 100644 tests/benchmark/testReduceConstantsDupNotNull.json delete mode 100644 tests/benchmark/testReduceConstantsEliminatesFilter.json delete mode 100644 tests/benchmark/testReduceConstantsIsNotNull.json delete mode 100644 tests/benchmark/testReduceConstantsIsNull.json delete mode 100644 tests/benchmark/testReduceConstantsNegated.json delete mode 100644 tests/benchmark/testReduceConstantsNegatedInverted.json delete mode 100644 tests/benchmark/testReduceConstantsNull.json delete mode 100644 tests/benchmark/testReduceConstantsNullEqualsOne.json delete mode 100644 tests/benchmark/testReduceConstantsProjectNullable.json delete mode 100644 tests/benchmark/testReduceConstantsRequiresExecutor.json delete mode 100644 tests/benchmark/testReduceDynamic.json delete mode 100644 tests/benchmark/testReduceNestedCaseWhen.json delete mode 100644 tests/benchmark/testReduceNullableToNotNull.json delete mode 100644 tests/benchmark/testReduceNullableToNotNull2.json delete mode 100644 tests/benchmark/testReduceOrCaseWhen.json delete mode 100644 tests/benchmark/testReduceValuesToEmpty.json delete mode 100644 tests/benchmark/testReduceValuesUnderFilter.json delete mode 100644 tests/benchmark/testReduceValuesUnderProject.json delete mode 100644 tests/benchmark/testReduceValuesUnderProjectFilter.json delete mode 100644 tests/benchmark/testReduceWithNonTypePredicate.json delete mode 100644 tests/benchmark/testRemoveDistinctOnAgg.json delete mode 100644 tests/benchmark/testRemoveSemiJoin.json delete mode 100644 tests/benchmark/testRemoveSemiJoinRight.json delete mode 100644 tests/benchmark/testRemoveSemiJoinRightWithFilter.json delete mode 100644 tests/benchmark/testRemoveSemiJoinWithFilter.json delete mode 100644 tests/benchmark/testRightEmptyAntiJoin.json delete mode 100644 tests/benchmark/testRightEmptyAntiJoinNonEqui.json delete mode 100644 tests/benchmark/testRightEmptyFullJoin.json delete mode 100644 tests/benchmark/testRightEmptyInnerJoin.json delete mode 100644 tests/benchmark/testRightEmptyLeftJoin.json delete mode 100644 tests/benchmark/testRightEmptyRightJoin.json delete mode 100644 tests/benchmark/testRightEmptySemiJoin.json delete mode 100644 tests/benchmark/testRightOuterJoinSimplificationToInner.json delete mode 100644 tests/benchmark/testSemiJoinProjectTranspose.json delete mode 100644 tests/benchmark/testSemiJoinReduceConstants.json delete mode 100644 tests/benchmark/testSemiJoinRule.json delete mode 100644 tests/benchmark/testSemiJoinRuleExists.json delete mode 100644 tests/benchmark/testSemiJoinRuleLeft.json delete mode 100644 tests/benchmark/testSemiJoinRuleWithHint.json delete mode 100644 tests/benchmark/testSemiJoinRuleWithJoinOnUniqueInput.json delete mode 100644 tests/benchmark/testSemiJoinTrim.json delete mode 100644 tests/benchmark/testSimplifyFilter.json delete mode 100644 tests/benchmark/testSkipReduceConstantsCaseEquals.json delete mode 100644 tests/benchmark/testSome.json delete mode 100644 tests/benchmark/testSomeWithEquality.json delete mode 100644 tests/benchmark/testSomeWithEquality2.json delete mode 100644 tests/benchmark/testSomeWithNotEquality.json delete mode 100644 tests/benchmark/testSortJoinCopyInnerJoinOrderBy.json delete mode 100644 tests/benchmark/testSortJoinCopyInnerJoinOrderByLimit.json delete mode 100644 tests/benchmark/testSortJoinCopyInnerJoinOrderByTwoFields.json delete mode 100644 tests/benchmark/testSortJoinCopySemiJoinOrderBy.json delete mode 100644 tests/benchmark/testSortJoinCopySemiJoinOrderByLimitOffset.json delete mode 100644 tests/benchmark/testSortJoinCopySemiJoinOrderByOffset.json delete mode 100644 tests/benchmark/testSortJoinTranspose1.json delete mode 100644 tests/benchmark/testSortJoinTranspose2.json delete mode 100644 tests/benchmark/testSortJoinTranspose4.json delete mode 100644 tests/benchmark/testSortJoinTranspose6.json delete mode 100644 tests/benchmark/testSortProjectTranspose1.json delete mode 100644 tests/benchmark/testSortProjectTranspose2.json delete mode 100644 tests/benchmark/testSortRemovalAllKeysConstant.json delete mode 100644 tests/benchmark/testSortRemovalOneKeyConstant.json delete mode 100644 tests/benchmark/testSortUnionTranspose.json delete mode 100644 tests/benchmark/testSortUnionTranspose2.json delete mode 100644 tests/benchmark/testSortUnionTranspose3.json delete mode 100644 tests/benchmark/testSpatialContainsPoint.json delete mode 100644 tests/benchmark/testSpatialDWithinLine.json delete mode 100644 tests/benchmark/testSpatialDWithinReversed.json delete mode 100644 tests/benchmark/testSpatialDWithinToHilbert.json delete mode 100644 tests/benchmark/testSpatialDWithinToHilbertNegative.json delete mode 100644 tests/benchmark/testSpatialDWithinToHilbertZero.json delete mode 100644 tests/benchmark/testSpatialReduce.json delete mode 100644 tests/benchmark/testStrengthenJoinType.json delete mode 100644 tests/benchmark/testSumAndDistinctSumWithExpandSumType.json delete mode 100644 tests/benchmark/testSwapOuterJoin.json delete mode 100644 tests/benchmark/testTransitiveInferenceAggregate.json delete mode 100644 tests/benchmark/testTransitiveInferenceComplexPredicate.json delete mode 100644 tests/benchmark/testTransitiveInferenceConjunctInPullUp.json delete mode 100644 tests/benchmark/testTransitiveInferenceJoin.json delete mode 100644 tests/benchmark/testTransitiveInferenceJoin3way.json delete mode 100644 tests/benchmark/testTransitiveInferenceJoin3wayAgg.json delete mode 100644 tests/benchmark/testTransitiveInferenceLeftOuterJoin.json delete mode 100644 tests/benchmark/testTransitiveInferenceProject.json delete mode 100644 tests/benchmark/testTransitiveInferencePullUpThruAlias.json delete mode 100644 tests/benchmark/testTransitiveInferenceRightOuterJoin.json delete mode 100644 tests/benchmark/testTransitiveInferenceUnion.json delete mode 100644 tests/benchmark/testTransitiveInferenceUnion3way.json delete mode 100644 tests/benchmark/testTransitiveInferenceUnionAlwaysTrue.json delete mode 100644 tests/benchmark/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json delete mode 100644 tests/benchmark/testUnionMergeRule.json delete mode 100644 tests/benchmark/testUnionToDistinctRule.json delete mode 100644 tests/benchmark/testWhereAnyCorrelatedInSelect.json delete mode 100644 tests/benchmark/testWhereExpressionInCorrelated.json delete mode 100644 tests/benchmark/testWhereExpressionInCorrelated2.json delete mode 100644 tests/benchmark/testWhereInCorrelated.json delete mode 100644 tests/benchmark/testWhereInJoinCorrelated.json delete mode 100644 tests/benchmark/testWhereNotInCorrelated.json delete mode 100644 tests/benchmark/testWhereNotInCorrelated2.json delete mode 100644 tests/benchmark/testWhereOrSubQuery.json delete mode 100644 tests/benchmark/testWithinDistinct.json delete mode 100644 tests/benchmark/testWithinDistinctCountDistinct.json delete mode 100644 tests/benchmark/testWithinDistinctFilteredAggs.json delete mode 100644 tests/benchmark/testWithinDistinctFilteredAggsSameFilter.json delete mode 100644 tests/benchmark/testWithinDistinctFilteredAggsUniformDistinctKeys.json delete mode 100644 tests/benchmark/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json delete mode 100644 tests/benchmark/testWithinDistinctNoThrow.json delete mode 100644 tests/benchmark/testWithinDistinctUniformDistinctKeys.json delete mode 100644 tests/benchmark/testWithinDistinctUniformDistinctKeysNoThrow.json create mode 100644 tests/calcite/testAddRedundantSemiJoinRule.json create mode 100644 tests/calcite/testAggregateCaseToFilter.json create mode 100644 tests/calcite/testAggregateConstantKeyRule.json create mode 100644 tests/calcite/testAggregateConstantKeyRule3.json create mode 100644 tests/calcite/testAggregateDynamicFunction.json create mode 100644 tests/calcite/testAggregateExtractProjectRule.json create mode 100644 tests/calcite/testAggregateExtractProjectRuleWithGroupingSets.json create mode 100644 tests/calcite/testAggregateExtractProjectRuleWithGroupingSets2.json create mode 100644 tests/calcite/testAggregateGroupingSetsProjectMerge.json create mode 100644 tests/calcite/testAggregateJoinRemove1.json create mode 100644 tests/calcite/testAggregateJoinRemove10.json create mode 100644 tests/calcite/testAggregateJoinRemove11.json create mode 100644 tests/calcite/testAggregateJoinRemove2.json create mode 100644 tests/calcite/testAggregateJoinRemove3.json create mode 100644 tests/calcite/testAggregateJoinRemove4.json create mode 100644 tests/calcite/testAggregateJoinRemove5.json create mode 100644 tests/calcite/testAggregateJoinRemove6.json create mode 100644 tests/calcite/testAggregateJoinRemove7.json create mode 100644 tests/calcite/testAggregateJoinRemove8.json create mode 100644 tests/calcite/testAggregateJoinRemove9.json create mode 100644 tests/calcite/testAggregateMerge1.json create mode 100644 tests/calcite/testAggregateMerge2.json create mode 100644 tests/calcite/testAggregateMerge8.json create mode 100644 tests/calcite/testAggregateMergeSum0.json create mode 100644 tests/calcite/testAggregateProjectMerge.json create mode 100644 tests/calcite/testAggregateProjectPullUpConstants.json create mode 100644 tests/calcite/testAggregateProjectPullUpConstants2.json create mode 100644 tests/calcite/testAggregateRemove1.json create mode 100644 tests/calcite/testAggregateRemove2.json create mode 100644 tests/calcite/testAggregateRemove3.json create mode 100644 tests/calcite/testAggregateRemove7.json create mode 100644 tests/calcite/testAggregateUnionTransposeWithOneInputUnique.json create mode 100644 tests/calcite/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json create mode 100644 tests/calcite/testAll.json create mode 100644 tests/calcite/testAlreadyFalseEliminatesFilter.json create mode 100644 tests/calcite/testAntiJoinProjectTranspose.json create mode 100644 tests/calcite/testAnyInProjectNonNullable.json create mode 100644 tests/calcite/testAnyInProjectNullable.json create mode 100644 tests/calcite/testBitAndReuseDistinctAttrWithMixedOptionality.json create mode 100644 tests/calcite/testBitOrReuseDistinctAttrWithMixedOptionality.json create mode 100644 tests/calcite/testCasePushIsAlwaysWorking.json create mode 100644 tests/calcite/testCastInAggregateExpandDistinctAggregatesRule.json create mode 100644 tests/calcite/testCastInAggregateReduceFunctions.json create mode 100644 tests/calcite/testCustomColumnResolvingInCorrelatedSubQuery.json create mode 100644 tests/calcite/testCustomColumnResolvingInCorrelatedSubQuery2.json create mode 100644 tests/calcite/testCustomColumnResolvingInNonCorrelatedSubQuery.json create mode 100644 tests/calcite/testDecorrelateAggWithConstantGroupKey.json create mode 100644 tests/calcite/testDecorrelateExists.json create mode 100644 tests/calcite/testDecorrelateTwoExists.json create mode 100644 tests/calcite/testDecorrelateTwoIn.json create mode 100644 tests/calcite/testDecorrelateUncorrelatedInAndCorrelatedExists.json create mode 100644 tests/calcite/testDigestOfApproximateDistinctAggregateCall.json create mode 100644 tests/calcite/testDistinctCount1.json create mode 100644 tests/calcite/testDistinctCount2.json create mode 100644 tests/calcite/testDistinctCount3.json create mode 100644 tests/calcite/testDistinctCountGroupingSets1.json create mode 100644 tests/calcite/testDistinctCountGroupingSets2.json create mode 100644 tests/calcite/testDistinctCountMixed.json create mode 100644 tests/calcite/testDistinctCountMixed2.json create mode 100644 tests/calcite/testDistinctCountMixedJoin.json create mode 100644 tests/calcite/testDistinctCountMultiple.json create mode 100644 tests/calcite/testDistinctCountMultipleNoGroup.json create mode 100644 tests/calcite/testDistinctCountMultipleViaJoin.json create mode 100644 tests/calcite/testDistinctCountWithExpandSumType.json create mode 100644 tests/calcite/testDistinctCountWithoutGroupBy.json create mode 100644 tests/calcite/testDistinctNonDistinctAggregates.json create mode 100644 tests/calcite/testDistinctNonDistinctAggregatesWithGrouping1.json create mode 100644 tests/calcite/testDistinctNonDistinctAggregatesWithGrouping2.json create mode 100644 tests/calcite/testDistinctNonDistinctTwoAggregatesWithGrouping.json create mode 100644 tests/calcite/testDistinctWithDiffFiltersAndSameGroupSet.json create mode 100644 tests/calcite/testDistinctWithFilterAndGroupBy.json create mode 100644 tests/calcite/testDistinctWithFilterWithoutGroupBy.json create mode 100644 tests/calcite/testDistinctWithGrouping.json create mode 100644 tests/calcite/testDistinctWithMultipleInputs.json create mode 100644 tests/calcite/testDistinctWithMultipleInputsAndGroupby.json create mode 100644 tests/calcite/testEmptyAggregate.json create mode 100644 tests/calcite/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json create mode 100644 tests/calcite/testEmptyFilterProjectUnion.json create mode 100644 tests/calcite/testEmptyIntersect.json create mode 100644 tests/calcite/testEmptyMinus.json create mode 100644 tests/calcite/testEmptyMinus2.json create mode 100644 tests/calcite/testEmptyProject.json create mode 100644 tests/calcite/testEmptyProject2.json create mode 100644 tests/calcite/testEmptySort.json create mode 100644 tests/calcite/testEmptySort2.json create mode 100644 tests/calcite/testEmptySortLimitZero.json create mode 100644 tests/calcite/testExistsWithAtLeastOneRowSubQuery.json create mode 100644 tests/calcite/testExistsWithNoRowSubQuery.json create mode 100644 tests/calcite/testExpandFilterExists.json create mode 100644 tests/calcite/testExpandFilterExistsSimple.json create mode 100644 tests/calcite/testExpandFilterExistsSimpleAnd.json create mode 100644 tests/calcite/testExpandFilterIn.json create mode 100644 tests/calcite/testExpandFilterIn3Value.json create mode 100644 tests/calcite/testExpandFilterInComposite.json create mode 100644 tests/calcite/testExpandFilterScalar.json create mode 100644 tests/calcite/testExpandJoinExists.json create mode 100644 tests/calcite/testExpandJoinScalar.json create mode 100644 tests/calcite/testExpandProjectExists.json create mode 100644 tests/calcite/testExpandProjectIn.json create mode 100644 tests/calcite/testExpandProjectInComposite.json create mode 100644 tests/calcite/testExpandProjectInNullable.json create mode 100644 tests/calcite/testExpandProjectScalar.json create mode 100644 tests/calcite/testExpandWhereComparisonCorrelated.json create mode 100644 tests/calcite/testExpressionSimplification1.json create mode 100644 tests/calcite/testExpressionSimplification2.json create mode 100644 tests/calcite/testExtractJoinFilterRule.json create mode 100644 tests/calcite/testExtractYearMonthToRange.json create mode 100644 tests/calcite/testExtractYearToRange.json create mode 100644 tests/calcite/testFilterJoinRuleAndIsNotNull.json create mode 100644 tests/calcite/testFilterJoinRuleOrIsNotNull.json create mode 100644 tests/calcite/testFilterProjectTranspose.json create mode 100644 tests/calcite/testFilterRemoveIsNotDistinctFromRule.json create mode 100644 tests/calcite/testFlattenUncorrelatedCallBelowEquals.json create mode 100644 tests/calcite/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json create mode 100644 tests/calcite/testFullOuterJoinSimplificationToInner.json create mode 100644 tests/calcite/testFullOuterJoinSimplificationToLeftOuter.json create mode 100644 tests/calcite/testFullOuterJoinSimplificationToRightOuter.json create mode 100644 tests/calcite/testGroupByBooleanLiteralSimple.json create mode 100644 tests/calcite/testGroupByDateLiteralSimple.json create mode 100644 tests/calcite/testGroupByMultipleLiterals.json create mode 100644 tests/calcite/testInferringPredicatesWithNotOperatorInJoinCondition.json create mode 100644 tests/calcite/testIntersectToDistinct.json create mode 100644 tests/calcite/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json create mode 100644 tests/calcite/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json create mode 100644 tests/calcite/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json create mode 100644 tests/calcite/testJoinConditionPushdown1.json create mode 100644 tests/calcite/testJoinConditionPushdown2.json create mode 100644 tests/calcite/testJoinConditionPushdown4.json create mode 100644 tests/calcite/testJoinConditionPushdown6.json create mode 100644 tests/calcite/testJoinDeriveIsNotNullFilterRule1.json create mode 100644 tests/calcite/testJoinDeriveIsNotNullFilterRule12.json create mode 100644 tests/calcite/testJoinDeriveIsNotNullFilterRule2.json create mode 100644 tests/calcite/testJoinDeriveIsNotNullFilterRule3.json create mode 100644 tests/calcite/testJoinDeriveIsNotNullFilterRule4.json create mode 100644 tests/calcite/testJoinDeriveIsNotNullFilterRule5.json create mode 100644 tests/calcite/testJoinProjectTranspose1.json create mode 100644 tests/calcite/testJoinProjectTranspose7.json create mode 100644 tests/calcite/testJoinProjectTranspose8.json create mode 100644 tests/calcite/testJoinProjectTransposeWindow.json create mode 100644 tests/calcite/testJoinPushTransitivePredicatesRule2.json create mode 100644 tests/calcite/testLeftEmptyAntiJoin.json create mode 100644 tests/calcite/testLeftEmptyFullJoin.json create mode 100644 tests/calcite/testLeftEmptyInnerJoin.json create mode 100644 tests/calcite/testLeftEmptyLeftJoin.json create mode 100644 tests/calcite/testLeftEmptyRightJoin.json create mode 100644 tests/calcite/testLeftEmptySemiJoin.json create mode 100644 tests/calcite/testLeftOuterJoinSimplificationToInner.json create mode 100644 tests/calcite/testMaxReuseDistinctAttrWithMixedOptionality.json create mode 100644 tests/calcite/testMergeFilter.json create mode 100644 tests/calcite/testMergeIntersect.json create mode 100644 tests/calcite/testMergeJoinFilter.json create mode 100644 tests/calcite/testMergeMinus.json create mode 100644 tests/calcite/testMergeUnionAll.json create mode 100644 tests/calcite/testMergeUnionDistinct.json create mode 100644 tests/calcite/testMergeUnionMixed2.json create mode 100644 tests/calcite/testMinReuseDistinctAttrWithMixedOptionality.json create mode 100644 tests/calcite/testMinusMergeRule.json create mode 100644 tests/calcite/testMultipleDistinctWithGrouping.json create mode 100644 tests/calcite/testNoOversimplificationBelowIsNull.json create mode 100644 tests/calcite/testOrAlwaysTrue.json create mode 100644 tests/calcite/testOrAlwaysTrue2.json create mode 100644 tests/calcite/testOversimplifiedCaseStatement.json create mode 100644 tests/calcite/testProjectAggregateMerge.json create mode 100644 tests/calcite/testProjectAggregateMergeSum0.json create mode 100644 tests/calcite/testProjectAggregateMergeSum0AndSum.json create mode 100644 tests/calcite/testProjectCorrelateTransposeRuleAntiCorrelate.json create mode 100644 tests/calcite/testProjectCorrelateTransposeRuleLeftCorrelate.json create mode 100644 tests/calcite/testProjectCorrelateTransposeRuleSemiCorrelate.json create mode 100644 tests/calcite/testProjectFilterTransposeRuleOnEmptyRowType.json create mode 100644 tests/calcite/testProjectJoinRemove1.json create mode 100644 tests/calcite/testProjectJoinRemove10.json create mode 100644 tests/calcite/testProjectJoinRemove4.json create mode 100644 tests/calcite/testProjectJoinRemove7.json create mode 100644 tests/calcite/testProjectJoinTransposeItem.json create mode 100644 tests/calcite/testProjectSetOpTranspose.json create mode 100644 tests/calcite/testPullAggregateThroughUnion.json create mode 100644 tests/calcite/testPullAggregateThroughUnion2.json create mode 100644 tests/calcite/testPullAggregateThroughUnionAndAddProjects.json create mode 100644 tests/calcite/testPullAggregateThroughUnionWithAlias.json create mode 100644 tests/calcite/testPullConstantIntoFilter.json create mode 100644 tests/calcite/testPullConstantIntoJoin.json create mode 100644 tests/calcite/testPullConstantIntoJoin2.json create mode 100644 tests/calcite/testPullConstantIntoProject.json create mode 100644 tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFrom.json create mode 100644 tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json create mode 100644 tests/calcite/testPullConstantThroughAggregateAllConst.json create mode 100644 tests/calcite/testPullConstantThroughAggregateAllLiterals.json create mode 100644 tests/calcite/testPullConstantThroughAggregateConstGroupBy.json create mode 100644 tests/calcite/testPullConstantThroughAggregatePermuted.json create mode 100644 tests/calcite/testPullConstantThroughAggregatePermutedConstFirst.json create mode 100644 tests/calcite/testPullConstantThroughAggregatePermutedConstGroupBy.json create mode 100644 tests/calcite/testPullConstantThroughAggregateSimpleNonNullable.json create mode 100644 tests/calcite/testPullConstantThroughConstLast.json create mode 100644 tests/calcite/testPullConstantThroughUnion.json create mode 100644 tests/calcite/testPullConstantThroughUnion3.json create mode 100644 tests/calcite/testPullFilterThroughAggregate.json create mode 100644 tests/calcite/testPullFilterThroughAggregateGroupingSets.json create mode 100644 tests/calcite/testPullNull.json create mode 100644 tests/calcite/testPushAboveFiltersIntoInnerJoinCondition.json create mode 100644 tests/calcite/testPushAggregateFunctionsThroughJoin.json create mode 100644 tests/calcite/testPushAggregateSumNoGroup.json create mode 100644 tests/calcite/testPushAggregateSumThroughJoin.json create mode 100644 tests/calcite/testPushAggregateSumThroughJoinAfterAggregateReduce.json create mode 100644 tests/calcite/testPushAggregateSumWithoutGroupKeyThroughJoin.json create mode 100644 tests/calcite/testPushAggregateThroughJoin1.json create mode 100644 tests/calcite/testPushAggregateThroughJoin2.json create mode 100644 tests/calcite/testPushAggregateThroughJoin4.json create mode 100644 tests/calcite/testPushAggregateThroughJoin5.json create mode 100644 tests/calcite/testPushAggregateThroughJoin6.json create mode 100644 tests/calcite/testPushAggregateThroughJoin7.json create mode 100644 tests/calcite/testPushAggregateThroughJoin8.json create mode 100644 tests/calcite/testPushAggregateThroughJoinDistinct.json create mode 100644 tests/calcite/testPushAggregateThroughJoinOnEmptyLogicalValues.json create mode 100644 tests/calcite/testPushAggregateThroughJoinWithUniqueInput.json create mode 100644 tests/calcite/testPushAggregateThroughOuterJoin1.json create mode 100644 tests/calcite/testPushAggregateThroughOuterJoin12.json create mode 100644 tests/calcite/testPushAggregateThroughOuterJoin13.json create mode 100644 tests/calcite/testPushAggregateThroughOuterJoin14.json create mode 100644 tests/calcite/testPushAggregateThroughOuterJoin15.json create mode 100644 tests/calcite/testPushAggregateThroughOuterJoin16.json create mode 100644 tests/calcite/testPushAggregateThroughOuterJoin2.json create mode 100644 tests/calcite/testPushAggregateThroughOuterJoin3.json create mode 100644 tests/calcite/testPushAggregateThroughOuterJoin4.json create mode 100644 tests/calcite/testPushAggregateThroughOuterJoin5.json create mode 100644 tests/calcite/testPushAggregateThroughOuterJoin6.json create mode 100644 tests/calcite/testPushAggregateThroughOuterJoin7.json create mode 100644 tests/calcite/testPushAggregateThroughOuterJoin8.json create mode 100644 tests/calcite/testPushAggregateThroughOuterJoin9.json create mode 100644 tests/calcite/testPushAvgGroupingSetsThroughUnion.json create mode 100644 tests/calcite/testPushAvgThroughUnion.json create mode 100644 tests/calcite/testPushBoolAndBoolOrThroughUnion.json create mode 100644 tests/calcite/testPushCountFilterThroughUnion.json create mode 100644 tests/calcite/testPushCountNullableGroupingSetsThroughUnion.json create mode 100644 tests/calcite/testPushCountNullableThroughUnion.json create mode 100644 tests/calcite/testPushCountStarGroupingSetsThroughUnion.json create mode 100644 tests/calcite/testPushCountStarThroughUnion.json create mode 100644 tests/calcite/testPushFilterPastAgg.json create mode 100644 tests/calcite/testPushFilterPastAggFour.json create mode 100644 tests/calcite/testPushFilterPastAggTwo.json create mode 100644 tests/calcite/testPushFilterPastAggWithGroupingSets2.json create mode 100644 tests/calcite/testPushFilterPastProject.json create mode 100644 tests/calcite/testPushFilterSemijoin.json create mode 100644 tests/calcite/testPushFilterThroughSemiJoin.json create mode 100644 tests/calcite/testPushFilterWithIsNotDistinctFromPastJoin.json create mode 100644 tests/calcite/testPushJoinCondDownToProject.json create mode 100644 tests/calcite/testPushJoinThroughUnionOnLeft.json create mode 100644 tests/calcite/testPushJoinThroughUnionOnRight.json create mode 100644 tests/calcite/testPushMaxNullableGroupingSetsThroughUnion.json create mode 100644 tests/calcite/testPushMaxNullableThroughUnion.json create mode 100644 tests/calcite/testPushMinGroupingSetsThroughUnion.json create mode 100644 tests/calcite/testPushMinThroughUnion.json create mode 100644 tests/calcite/testPushProjectPastFilter.json create mode 100644 tests/calcite/testPushProjectPastFilter2.json create mode 100644 tests/calcite/testPushProjectPastFilter3b.json create mode 100644 tests/calcite/testPushProjectPastFilter3c.json create mode 100644 tests/calcite/testPushProjectPastFullJoin.json create mode 100644 tests/calcite/testPushProjectPastFullJoinStrong.json create mode 100644 tests/calcite/testPushProjectPastInnerJoin.json create mode 100644 tests/calcite/testPushProjectPastInnerJoinStrong.json create mode 100644 tests/calcite/testPushProjectPastJoin.json create mode 100644 tests/calcite/testPushProjectPastLeftJoin.json create mode 100644 tests/calcite/testPushProjectPastLeftJoinSwap.json create mode 100644 tests/calcite/testPushProjectPastLeftJoinSwapStrong.json create mode 100644 tests/calcite/testPushProjectPastRightJoin.json create mode 100644 tests/calcite/testPushProjectPastRightJoinStrong.json create mode 100644 tests/calcite/testPushProjectPastRightJoinSwap.json create mode 100644 tests/calcite/testPushProjectPastRightJoinSwapStrong.json create mode 100644 tests/calcite/testPushProjectPastSetOp.json create mode 100644 tests/calcite/testPushProjectWithIsNotDistinctFromPastJoin.json create mode 100644 tests/calcite/testPushProjectWithOverPastJoin1.json create mode 100644 tests/calcite/testPushProjectWithOverPastJoin2.json create mode 100644 tests/calcite/testPushProjectWithOverPastJoin3.json create mode 100644 tests/calcite/testPushSemiJoinConditions.json create mode 100644 tests/calcite/testPushSemiJoinPastFilter.json create mode 100644 tests/calcite/testPushSemiJoinPastJoinRuleLeft.json create mode 100644 tests/calcite/testPushSemiJoinPastJoinRuleRight.json create mode 100644 tests/calcite/testPushSemiJoinPastProject.json create mode 100644 tests/calcite/testPushSumConstantGroupingSetsThroughUnion.json create mode 100644 tests/calcite/testPushSumConstantThroughUnion.json create mode 100644 tests/calcite/testPushSumCountStarGroupingSetsThroughUnion.json create mode 100644 tests/calcite/testPushSumCountStarThroughUnion.json create mode 100644 tests/calcite/testPushSumNullConstantGroupingSetsThroughUnion.json create mode 100644 tests/calcite/testPushSumNullConstantThroughUnion.json create mode 100644 tests/calcite/testPushSumNullableGroupingSetsThroughUnion.json create mode 100644 tests/calcite/testPushSumNullableNOGBYThroughUnion.json create mode 100644 tests/calcite/testPushSumNullableThroughUnion.json create mode 100644 tests/calcite/testReduceAggregateFunctionsByGroup.json create mode 100644 tests/calcite/testReduceAllAggregateFunctions.json create mode 100644 tests/calcite/testReduceAverage.json create mode 100644 tests/calcite/testReduceAverageAndSumWithNoReduceStddevAndVar.json create mode 100644 tests/calcite/testReduceAverageAndVarWithNoReduceStddev.json create mode 100644 tests/calcite/testReduceAverageWithNoReduceSum.json create mode 100644 tests/calcite/testReduceCase.json create mode 100644 tests/calcite/testReduceCaseNullabilityChange.json create mode 100644 tests/calcite/testReduceCastAndConsts.json create mode 100644 tests/calcite/testReduceCasts.json create mode 100644 tests/calcite/testReduceCompositeInSubQuery.json create mode 100644 tests/calcite/testReduceConstants.json create mode 100644 tests/calcite/testReduceConstants3.json create mode 100644 tests/calcite/testReduceConstantsCaseEquals.json create mode 100644 tests/calcite/testReduceConstantsCaseEquals2.json create mode 100644 tests/calcite/testReduceConstantsCaseEquals3.json create mode 100644 tests/calcite/testReduceConstantsDup.json create mode 100644 tests/calcite/testReduceConstantsDup2.json create mode 100644 tests/calcite/testReduceConstantsDup3.json create mode 100644 tests/calcite/testReduceConstantsDup3Null.json create mode 100644 tests/calcite/testReduceConstantsDupNot.json create mode 100644 tests/calcite/testReduceConstantsDupNot2.json create mode 100644 tests/calcite/testReduceConstantsDupNot2Null.json create mode 100644 tests/calcite/testReduceConstantsDupNotNull.json create mode 100644 tests/calcite/testReduceConstantsEliminatesFilter.json create mode 100644 tests/calcite/testReduceConstantsIsNotNull.json create mode 100644 tests/calcite/testReduceConstantsIsNull.json create mode 100644 tests/calcite/testReduceConstantsNegated.json create mode 100644 tests/calcite/testReduceConstantsNegatedInverted.json create mode 100644 tests/calcite/testReduceConstantsNull.json create mode 100644 tests/calcite/testReduceConstantsNullEqualsOne.json create mode 100644 tests/calcite/testReduceConstantsProjectNullable.json create mode 100644 tests/calcite/testReduceConstantsRequiresExecutor.json create mode 100644 tests/calcite/testReduceDynamic.json create mode 100644 tests/calcite/testReduceNestedCaseWhen.json create mode 100644 tests/calcite/testReduceNullableToNotNull.json create mode 100644 tests/calcite/testReduceNullableToNotNull2.json create mode 100644 tests/calcite/testReduceOrCaseWhen.json create mode 100644 tests/calcite/testReduceValuesToEmpty.json create mode 100644 tests/calcite/testReduceValuesUnderFilter.json create mode 100644 tests/calcite/testReduceValuesUnderProject.json create mode 100644 tests/calcite/testReduceValuesUnderProjectFilter.json create mode 100644 tests/calcite/testReduceWithNonTypePredicate.json create mode 100644 tests/calcite/testRemoveDistinctOnAgg.json create mode 100644 tests/calcite/testRemoveSemiJoin.json create mode 100644 tests/calcite/testRemoveSemiJoinRight.json create mode 100644 tests/calcite/testRemoveSemiJoinRightWithFilter.json create mode 100644 tests/calcite/testRemoveSemiJoinWithFilter.json create mode 100644 tests/calcite/testRightEmptyAntiJoin.json create mode 100644 tests/calcite/testRightEmptyAntiJoinNonEqui.json create mode 100644 tests/calcite/testRightEmptyFullJoin.json create mode 100644 tests/calcite/testRightEmptyInnerJoin.json create mode 100644 tests/calcite/testRightEmptyLeftJoin.json create mode 100644 tests/calcite/testRightEmptyRightJoin.json create mode 100644 tests/calcite/testRightEmptySemiJoin.json create mode 100644 tests/calcite/testRightOuterJoinSimplificationToInner.json create mode 100644 tests/calcite/testSemiJoinProjectTranspose.json create mode 100644 tests/calcite/testSemiJoinReduceConstants.json create mode 100644 tests/calcite/testSemiJoinRule.json create mode 100644 tests/calcite/testSemiJoinRuleExists.json create mode 100644 tests/calcite/testSemiJoinRuleLeft.json create mode 100644 tests/calcite/testSemiJoinRuleWithHint.json create mode 100644 tests/calcite/testSemiJoinRuleWithJoinOnUniqueInput.json create mode 100644 tests/calcite/testSemiJoinTrim.json create mode 100644 tests/calcite/testSimplifyFilter.json create mode 100644 tests/calcite/testSkipReduceConstantsCaseEquals.json create mode 100644 tests/calcite/testSome.json create mode 100644 tests/calcite/testSomeWithEquality.json create mode 100644 tests/calcite/testSomeWithEquality2.json create mode 100644 tests/calcite/testSomeWithNotEquality.json create mode 100644 tests/calcite/testSortJoinCopyInnerJoinOrderBy.json create mode 100644 tests/calcite/testSortJoinCopyInnerJoinOrderByLimit.json create mode 100644 tests/calcite/testSortJoinCopyInnerJoinOrderByTwoFields.json create mode 100644 tests/calcite/testSortJoinCopySemiJoinOrderBy.json create mode 100644 tests/calcite/testSortJoinCopySemiJoinOrderByLimitOffset.json create mode 100644 tests/calcite/testSortJoinCopySemiJoinOrderByOffset.json create mode 100644 tests/calcite/testSortJoinTranspose1.json create mode 100644 tests/calcite/testSortJoinTranspose2.json create mode 100644 tests/calcite/testSortJoinTranspose4.json create mode 100644 tests/calcite/testSortJoinTranspose6.json create mode 100644 tests/calcite/testSortProjectTranspose1.json create mode 100644 tests/calcite/testSortProjectTranspose2.json create mode 100644 tests/calcite/testSortRemovalAllKeysConstant.json create mode 100644 tests/calcite/testSortRemovalOneKeyConstant.json create mode 100644 tests/calcite/testSortUnionTranspose.json create mode 100644 tests/calcite/testSortUnionTranspose2.json create mode 100644 tests/calcite/testSortUnionTranspose3.json create mode 100644 tests/calcite/testSpatialContainsPoint.json create mode 100644 tests/calcite/testSpatialDWithinLine.json create mode 100644 tests/calcite/testSpatialDWithinReversed.json create mode 100644 tests/calcite/testSpatialDWithinToHilbert.json create mode 100644 tests/calcite/testSpatialDWithinToHilbertNegative.json create mode 100644 tests/calcite/testSpatialDWithinToHilbertZero.json create mode 100644 tests/calcite/testSpatialReduce.json create mode 100644 tests/calcite/testStrengthenJoinType.json create mode 100644 tests/calcite/testSumAndDistinctSumWithExpandSumType.json create mode 100644 tests/calcite/testSwapOuterJoin.json create mode 100644 tests/calcite/testTransitiveInferenceAggregate.json create mode 100644 tests/calcite/testTransitiveInferenceComplexPredicate.json create mode 100644 tests/calcite/testTransitiveInferenceConjunctInPullUp.json create mode 100644 tests/calcite/testTransitiveInferenceJoin.json create mode 100644 tests/calcite/testTransitiveInferenceJoin3way.json create mode 100644 tests/calcite/testTransitiveInferenceJoin3wayAgg.json create mode 100644 tests/calcite/testTransitiveInferenceLeftOuterJoin.json create mode 100644 tests/calcite/testTransitiveInferenceProject.json create mode 100644 tests/calcite/testTransitiveInferencePullUpThruAlias.json create mode 100644 tests/calcite/testTransitiveInferenceRightOuterJoin.json create mode 100644 tests/calcite/testTransitiveInferenceUnion.json create mode 100644 tests/calcite/testTransitiveInferenceUnion3way.json create mode 100644 tests/calcite/testTransitiveInferenceUnionAlwaysTrue.json create mode 100644 tests/calcite/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json create mode 100644 tests/calcite/testUnionMergeRule.json create mode 100644 tests/calcite/testUnionToDistinctRule.json create mode 100644 tests/calcite/testWhereAnyCorrelatedInSelect.json create mode 100644 tests/calcite/testWhereExpressionInCorrelated.json create mode 100644 tests/calcite/testWhereExpressionInCorrelated2.json create mode 100644 tests/calcite/testWhereInCorrelated.json create mode 100644 tests/calcite/testWhereInJoinCorrelated.json create mode 100644 tests/calcite/testWhereNotInCorrelated.json create mode 100644 tests/calcite/testWhereNotInCorrelated2.json create mode 100644 tests/calcite/testWhereOrSubQuery.json create mode 100644 tests/calcite/testWithinDistinct.json create mode 100644 tests/calcite/testWithinDistinctCountDistinct.json create mode 100644 tests/calcite/testWithinDistinctFilteredAggs.json create mode 100644 tests/calcite/testWithinDistinctFilteredAggsSameFilter.json create mode 100644 tests/calcite/testWithinDistinctFilteredAggsUniformDistinctKeys.json create mode 100644 tests/calcite/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json create mode 100644 tests/calcite/testWithinDistinctNoThrow.json create mode 100644 tests/calcite/testWithinDistinctUniformDistinctKeys.json create mode 100644 tests/calcite/testWithinDistinctUniformDistinctKeysNoThrow.json diff --git a/tests/benchmark/testAddRedundantSemiJoinRule.json b/tests/benchmark/testAddRedundantSemiJoinRule.json deleted file mode 100644 index 95cfc18..0000000 --- a/tests/benchmark/testAddRedundantSemiJoinRule.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":1}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalJoin(condition=[=($0, $1)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateCaseToFilter.json b/tests/benchmark/testAggregateCaseToFilter.json deleted file mode 100644 index 9503692..0000000 --- a/tests/benchmark/testAggregateCaseToFilter.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},{"column":7,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"40","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'x'","operand":[],"type":"CHAR"},{"operator":"NULL","operand":[],"type":"CHAR"}],"type":"CHAR"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"45","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"DECIMAL"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"70","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":5,"type":"CHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":8,"type":"DECIMAL"}],"distinct":false,"ignoreNulls":false,"type":"DECIMAL"},{"operator":"SUM","operand":[{"column":9,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":10,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},{"column":7,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"40","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'x'","operand":[],"type":"CHAR"},{"operator":"NULL","operand":[],"type":"CHAR"}],"type":"CHAR"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"45","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"DECIMAL"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"70","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BIGINT"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"operator":"CAST","operand":[{"column":4,"type":"BIGINT"}],"type":"INTEGER"},{"column":5,"type":"BIGINT"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"DECIMAL"},{"column":9,"type":"INTEGER"},{"column":10,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"DECIMAL"},{"column":7,"type":"INTEGER"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"40","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"45","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"<>","operand":[{"column":7,"type":"INTEGER"},{"operator":"70","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":10,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":12,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":1,"type":"DECIMAL"}],"distinct":false,"ignoreNulls":false,"type":"DECIMAL"},{"operator":"SUM","operand":[{"column":14,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"DECIMAL"},{"column":7,"type":"INTEGER"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"40","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"45","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"<>","operand":[{"column":7,"type":"INTEGER"},{"operator":"70","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)], COUNT_DISTINCT_CLERK=[COUNT(DISTINCT $1)], SUM_SAL_D10=[SUM($2)], SUM_SAL_D20=[SUM($3)], COUNT_D30=[SUM($4)], COUNT_D40=[COUNT($5)], COUNT_D45=[SUM($6)], COUNT_D50=[SUM($7)], SUM_NULL_D60=[SUM($8)], SUM_NULL_D70=[SUM($9)], COUNT_D20=[COUNT($10)])\n LogicalProject(SAL=[$5], $f1=[CASE(=($2, 'CLERK'), $7, null:INTEGER)], $f2=[CASE(=($7, 10), $5, null:INTEGER)], $f3=[CASE(=($7, 20), $5, 0)], $f4=[CASE(=($7, 30), 1, 0)], $f5=[CASE(=($7, 40), 'x', null:CHAR(1))], $f6=[CASE(=($7, 45), 1, null:INTEGER)], $f7=[CASE(=($7, 50), 1, null:INTEGER)], $f8=[null:DECIMAL(19, 9)], $f9=[CASE(=($7, 70), null:INTEGER, 1)], $f10=[CASE(=($7, 20), 1, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(SUM_SAL=[$0], COUNT_DISTINCT_CLERK=[$1], SUM_SAL_D10=[$2], SUM_SAL_D20=[$3], COUNT_D30=[CAST($4):INTEGER], COUNT_D40=[$5], COUNT_D45=[$6], COUNT_D50=[$7], SUM_NULL_D60=[$8], SUM_NULL_D70=[$9], COUNT_D20=[$10])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)], COUNT_DISTINCT_CLERK=[COUNT(DISTINCT $2) FILTER $3], SUM_SAL_D10=[SUM($4) FILTER $5], SUM_SAL_D20=[SUM($6) FILTER $7], COUNT_D30=[COUNT() FILTER $8], COUNT_D40=[COUNT() FILTER $9], COUNT_D45=[SUM($10) FILTER $11], COUNT_D50=[SUM($12) FILTER $13], SUM_NULL_D60=[SUM($1)], SUM_NULL_D70=[SUM($14) FILTER $15], COUNT_D20=[COUNT() FILTER $16])\n LogicalProject(SAL=[$5], $f8=[null:DECIMAL(19, 9)], DEPTNO=[$7], $f12=[=($2, 'CLERK')], SAL0=[$5], $f14=[=($7, 10)], SAL1=[$5], $f16=[=($7, 20)], $f17=[=($7, 30)], $f18=[=($7, 40)], $f19=[1], $f20=[=($7, 45)], $f21=[1], $f22=[=($7, 50)], $f23=[1], $f24=[<>($7, 70)], $f25=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateConstantKeyRule.json b/tests/benchmark/testAggregateConstantKeyRule.json deleted file mode 100644 index 0a11311..0000000 --- a/tests/benchmark/testAggregateConstantKeyRule.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":2,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}],"help":["LogicalProject(C=[$2])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$1], SAL=[$0])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(C=[$1])\n LogicalAggregate(group=[{0}], C=[COUNT()])\n LogicalProject(SAL=[$0])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateConstantKeyRule3.json b/tests/benchmark/testAggregateConstantKeyRule3.json deleted file mode 100644 index 3520567..0000000 --- a/tests/benchmark/testAggregateConstantKeyRule3.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","MGR"],"types":["VARCHAR","INTEGER"],"nullable":[false,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Clerk'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Clerk'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"_ISO-8859-1'Clerk'","operand":[],"type":"VARCHAR"},{"column":1,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Clerk'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Clerk'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}}}}],"help":["LogicalProject(JOB=[$1])\n LogicalFilter(condition=[>($2, 3)])\n LogicalAggregate(group=[{0, 1}], agg#0=[COUNT()])\n LogicalProject(MGR=[$1], JOB=[$0])\n LogicalFilter(condition=[AND(IS NULL($1), =($0, 'Clerk'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(JOB=[$0])\n LogicalFilter(condition=[>($1, 3)])\n LogicalProject(JOB=['Clerk':VARCHAR(10)], $f2=[$1])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalProject(MGR=[$1])\n LogicalFilter(condition=[AND(IS NULL($1), =($0, 'Clerk'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateDynamicFunction.json b/tests/benchmark/testAggregateDynamicFunction.json deleted file mode 100644 index 92e9ff7..0000000 --- a/tests/benchmark/testAggregateDynamicFunction.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["MGR","HIREDATE"],"types":["INTEGER","TIMESTAMP"],"nullable":[true,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"TIMESTAMP"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"TIMESTAMP"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"TIMESTAMP"},{"operator":"CURRENT_TIMESTAMP","operand":[],"type":"TIMESTAMP"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"TIMESTAMP"},{"column":3,"type":"TIMESTAMP"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"TIMESTAMP"},{"operator":"CURRENT_TIMESTAMP","operand":[],"type":"TIMESTAMP"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}}}}},{"project":{"target":[{"column":0,"type":"TIMESTAMP"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CURRENT_TIMESTAMP","operand":[],"type":"TIMESTAMP"},{"column":1,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"TIMESTAMP"},{"operator":"CURRENT_TIMESTAMP","operand":[],"type":"TIMESTAMP"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"TIMESTAMP"},{"operator":"CURRENT_TIMESTAMP","operand":[],"type":"TIMESTAMP"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}}}}],"help":["LogicalProject(HIREDATE=[$1])\n LogicalFilter(condition=[>($2, 3)])\n LogicalAggregate(group=[{0, 1}], agg#0=[COUNT()])\n LogicalFilter(condition=[AND(IS NULL($0), =($1, CURRENT_TIMESTAMP))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(HIREDATE=[$0])\n LogicalFilter(condition=[>($1, 3)])\n LogicalProject(HIREDATE=[CURRENT_TIMESTAMP], $f2=[$1])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalProject(MGR=[$0])\n LogicalFilter(condition=[AND(IS NULL($0), =($1, CURRENT_TIMESTAMP))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateExtractProjectRule.json b/tests/benchmark/testAggregateExtractProjectRule.json deleted file mode 100644 index d35ce30..0000000 --- a/tests/benchmark/testAggregateExtractProjectRule.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateExtractProjectRuleWithGroupingSets.json b/tests/benchmark/testAggregateExtractProjectRuleWithGroupingSets.json deleted file mode 100644 index 29839dc..0000000 --- a/tests/benchmark/testAggregateExtractProjectRuleWithGroupingSets.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","SAL","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}, {2}]], EXPR$2=[SUM($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}, {2}]], EXPR$2=[SUM($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateExtractProjectRuleWithGroupingSets2.json b/tests/benchmark/testAggregateExtractProjectRuleWithGroupingSets2.json deleted file mode 100644 index 294e506..0000000 --- a/tests/benchmark/testAggregateExtractProjectRuleWithGroupingSets2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {1}]], EXPR$2=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {1}]], EXPR$2=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateGroupingSetsProjectMerge.json b/tests/benchmark/testAggregateGroupingSetsProjectMerge.json deleted file mode 100644 index bc982fe..0000000 --- a/tests/benchmark/testAggregateGroupingSetsProjectMerge.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","SAL","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}],"help":["LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$1=[SUM($2)])\n LogicalProject(X=[$2], Y=[$0], Z=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(X=[$1], EXPR$1=[$2], Y=[$0])\n LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {2}, {}]], EXPR$1=[SUM($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove1.json b/tests/benchmark/testAggregateJoinRemove1.json deleted file mode 100644 index 00d9812..0000000 --- a/tests/benchmark/testAggregateJoinRemove1.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove10.json b/tests/benchmark/testAggregateJoinRemove10.json deleted file mode 100644 index c2a9910..0000000 --- a/tests/benchmark/testAggregateJoinRemove10.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":1}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1, $2)])\n LogicalProject(DEPTNO=[$0], NAME=[$2], NAME0=[$4])\n LogicalJoin(condition=[=($0, $3)], joinType=[left])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $2, $4)])\n LogicalJoin(condition=[=($0, $3)], joinType=[left])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove11.json b/tests/benchmark/testAggregateJoinRemove11.json deleted file mode 100644 index da7e488..0000000 --- a/tests/benchmark/testAggregateJoinRemove11.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO","SLACKER"],"types":["INTEGER","BOOLEAN"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$0], SLACKER=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove2.json b/tests/benchmark/testAggregateJoinRemove2.json deleted file mode 100644 index 7e2e495..0000000 --- a/tests/benchmark/testAggregateJoinRemove2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":1,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{1}], EXPR$1=[COUNT(DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove3.json b/tests/benchmark/testAggregateJoinRemove3.json deleted file mode 100644 index 5f581b8..0000000 --- a/tests/benchmark/testAggregateJoinRemove3.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$0], NAME=[$2])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $2)])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove4.json b/tests/benchmark/testAggregateJoinRemove4.json deleted file mode 100644 index 3e08569..0000000 --- a/tests/benchmark/testAggregateJoinRemove4.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}},{"scan":1}],"help":["LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove5.json b/tests/benchmark/testAggregateJoinRemove5.json deleted file mode 100644 index 20b7e2a..0000000 --- a/tests/benchmark/testAggregateJoinRemove5.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$1], NAME=[$2])\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove6.json b/tests/benchmark/testAggregateJoinRemove6.json deleted file mode 100644 index 082849a..0000000 --- a/tests/benchmark/testAggregateJoinRemove6.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":1,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$2], JOB=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{2}], EXPR$1=[COUNT(DISTINCT $0)])\n LogicalJoin(condition=[=($1, $2)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove7.json b/tests/benchmark/testAggregateJoinRemove7.json deleted file mode 100644 index 518f2ec..0000000 --- a/tests/benchmark/testAggregateJoinRemove7.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove8.json b/tests/benchmark/testAggregateJoinRemove8.json deleted file mode 100644 index a463ca1..0000000 --- a/tests/benchmark/testAggregateJoinRemove8.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":1}}}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":1}}}}},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$0], NAME0=[$3])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $2)])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateJoinRemove9.json b/tests/benchmark/testAggregateJoinRemove9.json deleted file mode 100644 index 3cfd72c..0000000 --- a/tests/benchmark/testAggregateJoinRemove9.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":1}}}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":5,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"scan":1}}}}},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$0], NAME=[$3])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0, 2}])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateMerge1.json b/tests/benchmark/testAggregateMerge1.json deleted file mode 100644 index f040ca4..0000000 --- a/tests/benchmark/testAggregateMerge1.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","MGR","SAL","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER","INTEGER"],"nullable":[false,true,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":7,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":6,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}],"help":["LogicalAggregate(group=[{1}], EXPR$1=[MIN($4)], Z=[MAX($3)], EXPR$3=[SUM($6)], N=[SUM($5)], SAL=[SUM($2)])\n LogicalAggregate(group=[{0, 3}], X=[SUM($2)], Z=[MAX($2)], Y=[MIN($2)], M=[COUNT()], R=[COUNT($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{2}], EXPR$1=[MIN($1)], Z=[MAX($1)], EXPR$3=[COUNT($0)], N=[COUNT()], SAL=[SUM($1)])\n LogicalProject(MGR=[$1], SAL=[$2], DEPTNO=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateMerge2.json b/tests/benchmark/testAggregateMerge2.json deleted file mode 100644 index 8d29fbb..0000000 --- a/tests/benchmark/testAggregateMerge2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","MGR","SAL","DEPTNO"],"types":["INTEGER","VARCHAR","INTEGER","INTEGER","INTEGER"],"nullable":[false,false,true,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":6,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":8,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$2=[$2], EXPR$3=[$3])\n LogicalAggregate(group=[{0, 2}], groups=[[{0}, {2}]], EXPR$2=[SUM($3)], EXPR$3=[SUM($4)])\n LogicalAggregate(group=[{0, 1, 4}], X=[SUM($3)], Y=[COUNT($2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$2=[$2], EXPR$3=[$3])\n LogicalAggregate(group=[{0, 3}], groups=[[{0}, {3}]], EXPR$2=[SUM($2)], EXPR$3=[COUNT($1)])\n LogicalProject(EMPNO=[$0], MGR=[$2], SAL=[$3], DEPTNO=[$4])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateMerge8.json b/tests/benchmark/testAggregateMerge8.json deleted file mode 100644 index e7363a3..0000000 --- a/tests/benchmark/testAggregateMerge8.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalAggregate(group=[{}], X=[SUM($0)], Z=[MIN($1)])\n LogicalAggregate(group=[{}], X=[SUM($0)], Y=[MIN($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], X=[SUM($0)], Z=[MIN($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateMergeSum0.json b/tests/benchmark/testAggregateMergeSum0.json deleted file mode 100644 index 3eac5c1..0000000 --- a/tests/benchmark/testAggregateMergeSum0.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalAggregate(group=[{}], agg#0=[$SUM0($2)])\n LogicalAggregate(group=[{0, 1}], COUNT_COMM=[COUNT()])\n LogicalProject(MGR=[$3], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateProjectMerge.json b/tests/benchmark/testAggregateProjectMerge.json deleted file mode 100644 index d761722..0000000 --- a/tests/benchmark/testAggregateProjectMerge.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","SAL","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}],"help":["LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM($2)])\n LogicalProject(X=[$2], Y=[$0], Z=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(X=[$1], EXPR$1=[$2], Y=[$0])\n LogicalAggregate(group=[{0, 2}], EXPR$1=[SUM($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateProjectPullUpConstants.json b/tests/benchmark/testAggregateProjectPullUpConstants.json deleted file mode 100644 index 5706856..0000000 --- a/tests/benchmark/testAggregateProjectPullUpConstants.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","JOB","SAL"],"types":["INTEGER","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":"10","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0, 1, 2}], S=[SUM($2)])\n LogicalProject(JOB=[$1], EMPNO=[$0], SAL=[$2])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(JOB=[$0], EMPNO=[10], SAL=[$1], S=[$2])\n LogicalAggregate(group=[{0, 1}], S=[SUM($1)])\n LogicalProject(JOB=[$1], SAL=[$2])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateProjectPullUpConstants2.json b/tests/benchmark/testAggregateProjectPullUpConstants2.json deleted file mode 100644 index cac8ac7..0000000 --- a/tests/benchmark/testAggregateProjectPullUpConstants2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","SAL"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'John'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'John'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"operator":"_ISO-8859-1'John'","operand":[],"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'John'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'John'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalFilter(condition=[=($0, 'John')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(ENAME=['John':VARCHAR(20)], SAL=[$0])\n LogicalAggregate(group=[{1}])\n LogicalFilter(condition=[=($0, 'John')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateRemove1.json b/tests/benchmark/testAggregateRemove1.json deleted file mode 100644 index e8f2d32..0000000 --- a/tests/benchmark/testAggregateRemove1.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"BIT_AND","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"BIT_OR","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":4,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":"1","operand":[],"type":"BIGINT"}],"source":{"scan":0}}}],"help":["LogicalProject(EMPNO=[$0], EXPR$1=[$2], EXPR$2=[$3], EXPR$3=[$4], EXPR$4=[$5], EXPR$5=[$6], EXPR$6=[$7])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM($2)], EXPR$2=[MIN($2)], EXPR$3=[MAX($2)], EXPR$4=[BIT_AND($2)], EXPR$5=[BIT_OR($2)], EXPR$6=[COUNT(DISTINCT $2)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], EXPR$1=[$5], EXPR$2=[$5], EXPR$3=[$5], EXPR$4=[$5], EXPR$5=[$5], EXPR$6=[1:BIGINT])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateRemove2.json b/tests/benchmark/testAggregateRemove2.json deleted file mode 100644 index 6eecdc7..0000000 --- a/tests/benchmark/testAggregateRemove2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"scan":0},{"scan":0}],"help":["LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateRemove3.json b/tests/benchmark/testAggregateRemove3.json deleted file mode 100644 index ab53415..0000000 --- a/tests/benchmark/testAggregateRemove3.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"BIGINT"},{"operator":"0","operand":[],"type":"BIGINT"}],"type":"BIGINT"}],"source":{"scan":0}}}],"help":["LogicalProject(EMPNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT($2)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], EXPR$1=[CASE(IS NOT NULL($3), 1:BIGINT, 0:BIGINT)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateRemove7.json b/tests/benchmark/testAggregateRemove7.json deleted file mode 100644 index e0b2ada..0000000 --- a/tests/benchmark/testAggregateRemove7.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["MGR","SAL","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[true,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(MGR=[$0], SUM_SAL=[$2])\n LogicalFilter(condition=[=($1, 100)])\n LogicalAggregate(group=[{0, 1}], SUM_SAL=[SUM($2)])\n LogicalProject(MGR=[$0], DEPTNO=[$2], SAL=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(MGR=[$0], SUM_SAL=[$2])\n LogicalFilter(condition=[=($1, 100)])\n LogicalAggregate(group=[{0, 1}], SUM_SAL=[SUM($2)])\n LogicalProject(MGR=[$0], DEPTNO=[$2], SAL=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateUnionTransposeWithOneInputUnique.json b/tests/benchmark/testAggregateUnionTransposeWithOneInputUnique.json deleted file mode 100644 index f942eca..0000000 --- a/tests/benchmark/testAggregateUnionTransposeWithOneInputUnique.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"union":[{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":8,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], T=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], T=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(DEPTNO=[$7], T=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], T=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json b/tests/benchmark/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json deleted file mode 100644 index 324cf59..0000000 --- a/tests/benchmark/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"union":[{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":8,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":8,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":8,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":8,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":8,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":8,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], T2=[$0])\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT($0)])\n LogicalUnion(all=[true])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$1], T2=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT($0)])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT($0)])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAll.json b/tests/benchmark/testAll.json deleted file mode 100644 index 9fb9c9b..0000000 --- a/tests/benchmark/testAll.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"NOT","operand":[{"operator":"<= SOME","operand":[{"column":0,"type":"INTEGER"}],"query":{"scan":1},"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"NOT","operand":[{"operator":"CAST","operand":[{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"IS TRUE","operand":[{"operator":"<=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":10,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":10,"type":"BIGINT"},{"column":11,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":10,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":"<=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"<=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":10,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":"<=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<=","operand":[{"column":10,"type":"BIGINT"},{"column":11,"type":"BIGINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BIGINT"},{"column":1,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[NOT(<= SOME($0, {\nLogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n}))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[NOT(CAST(OR(AND(IS TRUE(<=($0, $9)), <>($10, 0)), AND(>($10, $11), null, <>($10, 0), IS NOT TRUE(<=($0, $9))), AND(<=($0, $9), <>($10, 0), IS NOT TRUE(<=($0, $9)), <=($10, $11)))):BOOLEAN NOT NULL)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(m=[$0], c=[$1], d=[$1])\n LogicalAggregate(group=[{}], m=[MAX($0)], c=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAlreadyFalseEliminatesFilter.json b/tests/benchmark/testAlreadyFalseEliminatesFilter.json deleted file mode 100644 index 1443f51..0000000 --- a/tests/benchmark/testAlreadyFalseEliminatesFilter.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}]]}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[]}}}}],"help":["LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalFilter(condition=[false])\n LogicalValues(tuples=[[{ 1, 2 }]])\n","LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAntiJoinProjectTranspose.json b/tests/benchmark/testAntiJoinProjectTranspose.json deleted file mode 100644 index 393f30b..0000000 --- a/tests/benchmark/testAntiJoinProjectTranspose.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","DNAME","LOC"],"types":["TINYINT","VARCHAR","VARCHAR"],"nullable":[false,true,true],"key":[[0],[1],[2]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","DNAME","LOC"],"types":["TINYINT","VARCHAR","VARCHAR"],"nullable":[false,true,true],"key":[[0],[1],[2]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"ANTI","condition":{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"TINYINT"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":0,"type":"TINYINT"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":1,"type":"TINYINT"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}},{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"ANTI","condition":{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"TINYINT"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":0,"type":"TINYINT"}],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":1,"type":"TINYINT"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}],"help":["LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[anti])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n","LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[anti])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAnyInProjectNonNullable.json b/tests/benchmark/testAnyInProjectNonNullable.json deleted file mode 100644 index 4ddeb8b..0000000 --- a/tests/benchmark/testAnyInProjectNonNullable.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"> SOME","operand":[{"column":0,"type":"INTEGER"}],"query":{"scan":1},"type":"BOOLEAN"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CAST","operand":[{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"IS TRUE","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":3,"type":"BIGINT"},{"column":4,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<=","operand":[{"column":3,"type":"BIGINT"},{"column":4,"type":"BIGINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BIGINT"},{"column":1,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}],"help":["LogicalProject(NAME=[$1], EXPR$1=[> SOME($0, {\nLogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$1], EXPR$1=[CAST(OR(AND(IS TRUE(>($0, $2)), <>($3, 0)), AND(>($3, $4), null, <>($3, 0), IS NOT TRUE(>($0, $2))), AND(>($0, $2), <>($3, 0), IS NOT TRUE(>($0, $2)), <=($3, $4)))):BOOLEAN NOT NULL])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(m=[$0], c=[$1], d=[$1])\n LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testAnyInProjectNullable.json b/tests/benchmark/testAnyInProjectNullable.json deleted file mode 100644 index 6ef5953..0000000 --- a/tests/benchmark/testAnyInProjectNullable.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"IN","operand":[{"column":1,"type":"VARCHAR"}],"query":{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":1}}},"type":"BOOLEAN"}],"source":{"scan":0}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"IS NOT NULL","operand":[{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"<","operand":[{"column":3,"type":"BIGINT"},{"column":2,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"scan":1}}}}}}}]}}}}}}],"help":["LogicalProject(DEPTNO=[$0], EXPR$1=[IN($1, {\nLogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[OR(AND(IS NOT NULL($5), <>($2, 0)), AND(<($3, $2), null, <>($2, 0), IS NULL($5)))])\n LogicalJoin(condition=[=($1, $4)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(MGR=[$3], i=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testBitAndReuseDistinctAttrWithMixedOptionality.json b/tests/benchmark/testBitAndReuseDistinctAttrWithMixedOptionality.json deleted file mode 100644 index e5f1ea8..0000000 --- a/tests/benchmark/testBitAndReuseDistinctAttrWithMixedOptionality.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"BIT_AND","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"BIT_AND","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[BIT_AND($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT()], EXPR$2=[BIT_AND($0)])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testBitOrReuseDistinctAttrWithMixedOptionality.json b/tests/benchmark/testBitOrReuseDistinctAttrWithMixedOptionality.json deleted file mode 100644 index 26b6297..0000000 --- a/tests/benchmark/testBitOrReuseDistinctAttrWithMixedOptionality.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"BIT_OR","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"BIT_OR","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[BIT_OR($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT()], EXPR$2=[BIT_OR($0)])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testCasePushIsAlwaysWorking.json b/tests/benchmark/testCasePushIsAlwaysWorking.json deleted file mode 100644 index fe300ae..0000000 --- a/tests/benchmark/testCasePushIsAlwaysWorking.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","SAL"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=(CASE(>($1, 1000), $0, $1), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(AND(>($1, 1000), =($0, 1)), =($1, 1))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testCastInAggregateExpandDistinctAggregatesRule.json b/tests/benchmark/testCastInAggregateExpandDistinctAggregatesRule.json deleted file mode 100644 index e479fea..0000000 --- a/tests/benchmark/testCastInAggregateExpandDistinctAggregatesRule.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"BIGINT"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":"CAST","operand":[{"column":1,"type":"BIGINT"}],"type":"BIGINT"},{"operator":"CAST","operand":[{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"BIGINT"},{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"BIGINT"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"},{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BIGINT"},{"column":4,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"BIGINT"},{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"BIGINT"},{"column":3,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":4,"type":"VARCHAR"},{"column":5,"type":"BIGINT"},{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"column":5,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":4,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":5,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM(DISTINCT $1)], EXPR$2=[SUM(DISTINCT $2)])\n LogicalAggregate(group=[{0}], CN=[COUNT()], SM=[SUM($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0], EXPR$1=[CAST($1):BIGINT NOT NULL], EXPR$2=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) FILTER $3], EXPR$2=[SUM($2) FILTER $4])\n LogicalProject(NAME=[$0], CN=[$1], SM=[$2], $g_1=[=($3, 1)], $g_2=[=($3, 2)])\n LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1}, {0, 2}]], $g=[GROUPING($0, $1, $2)])\n LogicalAggregate(group=[{0}], CN=[COUNT()], SM=[SUM($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testCastInAggregateReduceFunctions.json b/tests/benchmark/testCastInAggregateReduceFunctions.json deleted file mode 100644 index 5bf87c3..0000000 --- a/tests/benchmark/testCastInAggregateReduceFunctions.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"STDDEV_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"STDDEV_SAMP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"VAR_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"VAR_SAMP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":"CAST","operand":[{"operator":"POWER","operand":[{"operator":"/","operand":[{"operator":"-","operand":[{"column":1,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"},{"operator":"0.5","operand":[],"type":"DECIMAL"}],"type":"DOUBLE"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"POWER","operand":[{"operator":"/","operand":[{"operator":"-","operand":[{"column":1,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BIGINT"},{"operator":"-","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"operator":"0.5","operand":[],"type":"DECIMAL"}],"type":"DOUBLE"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"-","operand":[{"column":1,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"-","operand":[{"column":1,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BIGINT"},{"operator":"-","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[STDDEV_SAMP($1)], EXPR$4=[VAR_POP($1)], EXPR$5=[VAR_SAMP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0], EXPR$1=[CAST(POWER(/(-($1, /(*($2, $2), $3)), $3), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[CAST(POWER(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1))), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$4=[CAST(/(-($1, /(*($2, $2), $3)), $3)):INTEGER NOT NULL], EXPR$5=[CAST(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1)))):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($2)], agg#1=[$SUM0($1)], agg#2=[COUNT()])\n LogicalProject(NAME=[$0], DEPTNO=[$1], $f2=[*($1, $1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testCustomColumnResolvingInCorrelatedSubQuery.json b/tests/benchmark/testCustomColumnResolvingInCorrelatedSubQuery.json deleted file mode 100644 index 643211c..0000000 --- a/tests/benchmark/testCustomColumnResolvingInCorrelatedSubQuery.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"T","fields":["\"K0\"","\"C1\"","\"F1\".\"A0\"","\"F2\".\"A0\"","\"F0\".\"C0\"","\"F1\".\"C0\"","\"F0\".\"C1\"","\"F1\".\"C2\"","\"F2\".\"C3\""],"types":["VARCHAR","VARCHAR","INTEGER","BOOLEAN","INTEGER","INTEGER","INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false,false,false,true,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"BOOLEAN"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"operator":"$SCALAR_QUERY","operand":[],"query":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":14,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":9,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":9,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":14,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":9,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"BOOLEAN"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":9,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"VARCHAR"},{"column":14,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":9,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":9,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"VARCHAR"},{"column":14,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}}],"help":["LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[=($4, $SCALAR_QUERY({\nLogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(\"F1\".\"C0\"=[$5])\n LogicalFilter(condition=[=($cor0.\"K0\", $0)])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n","LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[=($4, $9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{0}])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n LogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(\"F1\".\"C0\"=[$1])\n LogicalFilter(condition=[=($cor0.\"K0\", $0)])\n LogicalProject(\"K0\"=[$0], \"F1\".\"C0\"=[$5])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testCustomColumnResolvingInCorrelatedSubQuery2.json b/tests/benchmark/testCustomColumnResolvingInCorrelatedSubQuery2.json deleted file mode 100644 index 567cde8..0000000 --- a/tests/benchmark/testCustomColumnResolvingInCorrelatedSubQuery2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"T","fields":["\"K0\"","\"C1\"","\"F1\".\"A0\"","\"F2\".\"A0\"","\"F0\".\"C0\"","\"F1\".\"C0\"","\"F0\".\"C1\"","\"F1\".\"C2\"","\"F2\".\"C3\""],"types":["VARCHAR","VARCHAR","INTEGER","BOOLEAN","INTEGER","INTEGER","INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false,false,false,true,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"BOOLEAN"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IN","operand":[{"column":4,"type":"INTEGER"}],"query":{"project":{"target":[{"column":14,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"BOOLEAN"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":14,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":11,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":15,"type":"INTEGER"},{"column":17,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}}],"help":["LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[IN($4, {\nLogicalProject(C0=[$5])\n LogicalFilter(condition=[=($cor0.\"F1\".\"C2\", $7)])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n","LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[=($4, $9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n LogicalAggregate(group=[{0}])\n LogicalProject(C0=[$0])\n LogicalFilter(condition=[=($cor0.\"F1\".\"C2\", $1)])\n LogicalProject(\"F1\".\"C0\"=[$5], \"F1\".\"C2\"=[$7])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testCustomColumnResolvingInNonCorrelatedSubQuery.json b/tests/benchmark/testCustomColumnResolvingInNonCorrelatedSubQuery.json deleted file mode 100644 index c07683d..0000000 --- a/tests/benchmark/testCustomColumnResolvingInNonCorrelatedSubQuery.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"T","fields":["\"K0\"","\"C1\"","\"F1\".\"A0\"","\"F2\".\"A0\"","\"F0\".\"C0\"","\"F1\".\"C0\"","\"F0\".\"C1\"","\"F1\".\"C2\"","\"F2\".\"C3\""],"types":["VARCHAR","VARCHAR","INTEGER","BOOLEAN","INTEGER","INTEGER","INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false,false,false,true,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"BOOLEAN"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IN","operand":[{"column":4,"type":"INTEGER"}],"query":{"project":{"target":[{"column":14,"type":"INTEGER"}],"source":{"scan":0}}},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"BOOLEAN"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}],"help":["LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[IN($4, {\nLogicalProject(C0=[$5])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n})])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n","LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalJoin(condition=[=($4, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n LogicalAggregate(group=[{0}])\n LogicalProject(C0=[$5])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDecorrelateAggWithConstantGroupKey.json b/tests/benchmark/testDecorrelateAggWithConstantGroupKey.json deleted file mode 100644 index 480c79d..0000000 --- a/tests/benchmark/testDecorrelateAggWithConstantGroupKey.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"correlate":[{"scan":0},{"filter":{"condition":{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"project":{"target":[{"column":11,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":10,"type":"CHAR"}],"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"operator":"_ISO-8859-1'abc'","operand":[],"type":"CHAR"},{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":14,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":13,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"column":11,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":10,"type":"CHAR"},{"column":12,"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":13,"type":"INTEGER"},{"operator":"_ISO-8859-1'abc'","operand":[],"type":"CHAR"},{"column":12,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":11,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":18,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":12,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":10,"type":"INTEGER"},{"column":11,"type":"CHAR"}],"source":{"project":{"target":[{"column":12,"type":"INTEGER"},{"operator":"_ISO-8859-1'abc'","operand":[],"type":"CHAR"},{"column":11,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":17,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":14,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":10,"type":"INTEGER"},{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":11,"type":"CHAR"},{"column":13,"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":14,"type":"INTEGER"},{"operator":"_ISO-8859-1'abc'","operand":[],"type":"CHAR"},{"column":13,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":12,"type":"INTEGER"},{"column":17,"type":"INTEGER"},{"column":19,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}}}]}}}}]}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{3, 5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($cor0.SAL, $0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(EXPR$0=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$0=[MAX($2)])\n LogicalProject(DEPTNO=[$2], $f1=['abc'], SAL=[$1])\n LogicalFilter(condition=[=($cor0.MGR, $0)])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[AND(=($3, $10), =($5, $9))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[$2], EMPNO=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$0=[MAX($2)])\n LogicalProject(DEPTNO=[$7], EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDecorrelateExists.json b/tests/benchmark/testDecorrelateExists.json deleted file mode 100644 index 75e3981..0000000 --- a/tests/benchmark/testDecorrelateExists.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"EXISTS","operand":[],"query":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[EXISTS({\nLogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDecorrelateTwoExists.json b/tests/benchmark/testDecorrelateTwoExists.json deleted file mode 100644 index 983f5df..0000000 --- a/tests/benchmark/testDecorrelateTwoExists.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"EXISTS","operand":[],"query":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"type":"BOOLEAN"},{"operator":"NOT","operand":[{"operator":"EXISTS","operand":[],"query":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":11,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":14,"type":"INTEGER"},{"operator":"34","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}},"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NULL","operand":[{"column":11,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":10,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},"right":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"34","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"34","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(EXISTS({\nLogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), NOT(EXISTS({\nLogicalFilter(condition=[AND(=($2, $cor0.JOB), =($5, 34))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NULL($11)])\n LogicalJoin(condition=[=($2, $10)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$0], $f1=[true])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$0])\n LogicalFilter(condition=[=($1, 34)])\n LogicalProject(JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDecorrelateTwoIn.json b/tests/benchmark/testDecorrelateTwoIn.json deleted file mode 100644 index 071e12b..0000000 --- a/tests/benchmark/testDecorrelateTwoIn.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IN","operand":[{"column":0,"type":"INTEGER"}],"query":{"project":{"target":[{"column":4,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":1}}}}},"type":"BOOLEAN"},{"operator":"IN","operand":[{"column":0,"type":"INTEGER"}],"query":{"project":{"target":[{"column":4,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":7,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}],"help":["LogicalProject(SAL=[$3])\n LogicalFilter(condition=[AND(IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n}), IN($0, {\nLogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=($cor0.ENAME, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(SAL=[$3])\n LogicalJoin(condition=[AND(=($1, $7), =($0, $6))], joinType=[inner])\n LogicalJoin(condition=[AND(=($2, $5), =($0, $4))], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDecorrelateUncorrelatedInAndCorrelatedExists.json b/tests/benchmark/testDecorrelateUncorrelatedInAndCorrelatedExists.json deleted file mode 100644 index 2a8f86d..0000000 --- a/tests/benchmark/testDecorrelateUncorrelatedInAndCorrelatedExists.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IN","operand":[{"column":2,"type":"VARCHAR"}],"query":{"project":{"target":[{"column":11,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":14,"type":"INTEGER"},{"operator":"34","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"},{"operator":"EXISTS","operand":[],"query":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":9,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"34","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"34","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(IN($2, {\nLogicalProject(JOB=[$2])\n LogicalFilter(condition=[=($5, 34)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), EXISTS({\nLogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $10)], joinType=[inner])\n LogicalJoin(condition=[=($2, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$0])\n LogicalFilter(condition=[=($1, 34)])\n LogicalProject(JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDigestOfApproximateDistinctAggregateCall.json b/tests/benchmark/testDigestOfApproximateDistinctAggregateCall.json deleted file mode 100644 index a54e438..0000000 --- a/tests/benchmark/testDigestOfApproximateDistinctAggregateCall.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]},{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}],"help":["LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT(APPROXIMATE DISTINCT $1)])\n LogicalProject(DEPTNO=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalUnion(all=[true])\n LogicalAggregate(group=[{1}], EXPR$1=[COUNT(DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$1=[COUNT(APPROXIMATE DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCount1.json b/tests/benchmark/testDistinctCount1.json deleted file mode 100644 index 16dd752..0000000 --- a/tests/benchmark/testDistinctCount1.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$1], ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])\n LogicalAggregate(group=[{0, 1}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCount2.json b/tests/benchmark/testDistinctCount2.json deleted file mode 100644 index 418cb39..0000000 --- a/tests/benchmark/testDistinctCount2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","SAL","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BIGINT"},{"operator":"CAST","operand":[{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":5,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$2], ENAME=[$0], SAL=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1) FILTER $3], EXPR$2=[MIN($2) FILTER $4])\n LogicalProject(DEPTNO=[$1], ENAME=[$0], EXPR$2=[$2], $g_0=[=($3, 0)], $g_1=[=($3, 1)])\n LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {2}]], EXPR$2=[SUM($1)], $g=[GROUPING($2, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCount3.json b/tests/benchmark/testDistinctCount3.json deleted file mode 100644 index 64d8a77..0000000 --- a/tests/benchmark/testDistinctCount3.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"operator":"CAST","operand":[{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$2])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT(DISTINCT $0)], EXPR$1=[SUM($1)])\n LogicalProject(DEPTNO=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT() FILTER $2], EXPR$1=[MIN($1) FILTER $2])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $g_0=[=($2, 0)])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], $g=[GROUPING($0)])\n LogicalProject(DEPTNO=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountGroupingSets1.json b/tests/benchmark/testDistinctCountGroupingSets1.json deleted file mode 100644 index 826d855..0000000 --- a/tests/benchmark/testDistinctCountGroupingSets1.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB","DEPTNO"],"types":["VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":4,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":5,"type":"INTEGER"},{"column":6,"type":"VARCHAR"},{"column":7,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"VARCHAR"},{"column":7,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":6,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT(DISTINCT $2)])\n LogicalProject(DEPTNO=[$2], JOB=[$1], ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT() FILTER $2])\n LogicalProject(DEPTNO=[$0], JOB=[$1], $g_0=[=($3, 0)])\n LogicalAggregate(group=[{0, 1, 2}], $g=[GROUPING($0, $1, $2)])\n LogicalProject(DEPTNO=[$2], JOB=[$1], ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountGroupingSets2.json b/tests/benchmark/testDistinctCountGroupingSets2.json deleted file mode 100644 index 2962122..0000000 --- a/tests/benchmark/testDistinctCountGroupingSets2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB","SAL","DEPTNO"],"types":["VARCHAR","VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":4,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"BIGINT"},{"operator":"CAST","operand":[{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":4,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":6,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":8,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":5,"type":"INTEGER"},{"column":6,"type":"VARCHAR"},{"column":7,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"VARCHAR"},{"column":7,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT(DISTINCT $2)], EXPR$3=[SUM($3)])\n LogicalProject(DEPTNO=[$3], JOB=[$1], ENAME=[$0], SAL=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], JOB=[$1], EXPR$2=[$2], EXPR$3=[CAST($3):INTEGER NOT NULL])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT($2) FILTER $4], EXPR$3=[MIN($3) FILTER $5])\n LogicalProject(DEPTNO=[$0], JOB=[$1], ENAME=[$2], EXPR$3=[$3], $g_0=[=($4, 0)], $g_1=[=($4, 1)])\n LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1, 2}, {0, 1}]], EXPR$3=[SUM($3)], $g=[GROUPING($0, $1, $2)])\n LogicalProject(DEPTNO=[$3], JOB=[$1], ENAME=[$0], SAL=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountMixed.json b/tests/benchmark/testDistinctCountMixed.json deleted file mode 100644 index 16792ff..0000000 --- a/tests/benchmark/testDistinctCountMixed.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","SAL","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BIGINT"},{"operator":"CAST","operand":[{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], CDDJ=[COUNT(DISTINCT $0, $1)], S=[SUM($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], SAL=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], CDDJ=[$1], S=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], CDDJ=[COUNT($1) FILTER $3], S=[MIN($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], JOB=[$1], S=[$2], $g_0=[=($3, 0)], $g_1=[=($3, 1)])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]], S=[SUM($2)], $g=[GROUPING($0, $1)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], SAL=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountMixed2.json b/tests/benchmark/testDistinctCountMixed2.json deleted file mode 100644 index 1c9e6c3..0000000 --- a/tests/benchmark/testDistinctCountMixed2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB","SAL","DEPTNO"],"types":["VARCHAR","VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BIGINT"},{"column":2,"type":"BIGINT"},{"column":3,"type":"BIGINT"},{"operator":"CAST","operand":[{"column":4,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":6,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"},{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":7,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], CDE=[COUNT(DISTINCT $1)], CDJE=[COUNT(DISTINCT $2, $1)], CDDJ=[COUNT(DISTINCT $0, $2)], S=[SUM($3)])\n LogicalProject(DEPTNO=[$3], ENAME=[$0], JOB=[$1], SAL=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], CDE=[$1], CDJE=[$2], CDDJ=[$3], S=[CAST($4):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], CDE=[COUNT($1) FILTER $5], CDJE=[COUNT($2, $1) FILTER $4], CDDJ=[COUNT($2) FILTER $6], S=[MIN($3) FILTER $7])\n LogicalProject(DEPTNO=[$2], ENAME=[$0], JOB=[$1], S=[$3], $g_0=[=($4, 0)], $g_1=[=($4, 1)], $g_2=[=($4, 2)], $g_3=[=($4, 3)])\n LogicalAggregate(group=[{0, 1, 3}], groups=[[{0, 1, 3}, {0, 3}, {1, 3}, {3}]], S=[SUM($2)], $g=[GROUPING($3, $0, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountMixedJoin.json b/tests/benchmark/testDistinctCountMixedJoin.json deleted file mode 100644 index 76ee4d7..0000000 --- a/tests/benchmark/testDistinctCountMixedJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB","SAL","DEPTNO"],"types":["VARCHAR","VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"BIGINT"},{"column":5,"type":"BIGINT"},{"column":7,"type":"BIGINT"},{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"IS NOT DISTINCT FROM","operand":[{"column":0,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"IS NOT DISTINCT FROM","operand":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"IS NOT DISTINCT FROM","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[COUNT(DISTINCT $2, $1)], EXPR$3=[COUNT(DISTINCT $0, $2)], EXPR$4=[SUM($3)])\n LogicalProject(DEPTNO=[$3], ENAME=[$0], JOB=[$1], SAL=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[$3], EXPR$2=[$5], EXPR$3=[$7], EXPR$4=[$1])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $6)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{1}], EXPR$4=[SUM($0)])\n LogicalProject(SAL=[$2], DEPTNO=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(ENAME=[$0], DEPTNO=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{2}], EXPR$2=[COUNT()])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalProject(ENAME=[$0], JOB=[$1], DEPTNO=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$3=[COUNT()])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$1], DEPTNO=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountMultiple.json b/tests/benchmark/testDistinctCountMultiple.json deleted file mode 100644 index 2fbbf37..0000000 --- a/tests/benchmark/testDistinctCountMultiple.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB","DEPTNO"],"types":["VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":5,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":6,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[COUNT(DISTINCT $2)])\n LogicalProject(DEPTNO=[$2], ENAME=[$0], JOB=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1) FILTER $3], EXPR$2=[COUNT($2) FILTER $4])\n LogicalProject(DEPTNO=[$2], ENAME=[$0], JOB=[$1], $g_1=[=($3, 1)], $g_2=[=($3, 2)])\n LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 2}, {1, 2}]], $g=[GROUPING($2, $0, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountMultipleNoGroup.json b/tests/benchmark/testDistinctCountMultipleNoGroup.json deleted file mode 100644 index 479faf1..0000000 --- a/tests/benchmark/testDistinctCountMultipleNoGroup.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB"],"types":["VARCHAR","VARCHAR"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":0,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":1,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":0,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":1,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[COUNT($0) FILTER $2], EXPR$1=[COUNT($1) FILTER $3])\n LogicalProject(ENAME=[$0], JOB=[$1], $g_1=[=($2, 1)], $g_2=[=($2, 2)])\n LogicalAggregate(group=[{0, 1}], groups=[[{0}, {1}]], $g=[GROUPING($0, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountMultipleViaJoin.json b/tests/benchmark/testDistinctCountMultipleViaJoin.json deleted file mode 100644 index 76ee4d7..0000000 --- a/tests/benchmark/testDistinctCountMultipleViaJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB","SAL","DEPTNO"],"types":["VARCHAR","VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"BIGINT"},{"column":5,"type":"BIGINT"},{"column":7,"type":"BIGINT"},{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"IS NOT DISTINCT FROM","operand":[{"column":0,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"IS NOT DISTINCT FROM","operand":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"IS NOT DISTINCT FROM","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[COUNT(DISTINCT $2, $1)], EXPR$3=[COUNT(DISTINCT $0, $2)], EXPR$4=[SUM($3)])\n LogicalProject(DEPTNO=[$3], ENAME=[$0], JOB=[$1], SAL=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[$3], EXPR$2=[$5], EXPR$3=[$7], EXPR$4=[$1])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $6)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{1}], EXPR$4=[SUM($0)])\n LogicalProject(SAL=[$2], DEPTNO=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$1=[COUNT()])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(ENAME=[$0], DEPTNO=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{2}], EXPR$2=[COUNT()])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalProject(ENAME=[$0], JOB=[$1], DEPTNO=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$3=[COUNT()])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$1], DEPTNO=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountWithExpandSumType.json b/tests/benchmark/testDistinctCountWithExpandSumType.json deleted file mode 100644 index a7930ae..0000000 --- a/tests/benchmark/testDistinctCountWithExpandSumType.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["COMM"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"project":{"target":[{"operator":"CAST","operand":[{"column":0,"type":"DECIMAL"}],"type":"BIGINT"},{"column":1,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":1,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"DECIMAL"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT()], EXPR$1=[COUNT(DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[CAST($0):BIGINT NOT NULL], EXPR$1=[$1])\n LogicalAggregate(group=[{}], EXPR$0=[$SUM0($1)], EXPR$1=[COUNT()])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctCountWithoutGroupBy.json b/tests/benchmark/testDistinctCountWithoutGroupBy.json deleted file mode 100644 index 2ea667e..0000000 --- a/tests/benchmark/testDistinctCountWithoutGroupBy.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":1,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":1,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":0,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":1,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[MAX($0)], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$1], ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[MIN($1) FILTER $3], EXPR$1=[COUNT($0) FILTER $2])\n LogicalProject(ENAME=[$0], EXPR$0=[$1], $g_0=[=($2, 0)], $g_1=[=($2, 1)])\n LogicalAggregate(group=[{0}], groups=[[{0}, {}]], EXPR$0=[MAX($1)], $g=[GROUPING($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctNonDistinctAggregates.json b/tests/benchmark/testDistinctNonDistinctAggregates.json deleted file mode 100644 index 9a6a818..0000000 --- a/tests/benchmark/testDistinctNonDistinctAggregates.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":3,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT()], EXPR$2=[AVG(DISTINCT $1)])\n LogicalProject(EMPNO=[$0], DEPTNO0=[$2])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($2)], EXPR$2=[AVG($1)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT()])\n LogicalProject(EMPNO=[$0], DEPTNO0=[$2])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctNonDistinctAggregatesWithGrouping1.json b/tests/benchmark/testDistinctNonDistinctAggregatesWithGrouping1.json deleted file mode 100644 index d8e0cd1..0000000 --- a/tests/benchmark/testDistinctNonDistinctAggregatesWithGrouping1.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL","COMM","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($0)], EXPR$2=[SUM(DISTINCT $1)], EXPR$3=[MAX($0)], EXPR$4=[MAX($2)])\n LogicalProject(DEPTNO=[$2], SAL=[$0], COMM=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($2)], EXPR$2=[SUM($1)], EXPR$3=[MAX($3)], EXPR$4=[MAX($4)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM($0)], EXPR$3=[MAX($0)], EXPR$4=[MAX($2)])\n LogicalProject(DEPTNO=[$2], SAL=[$0], COMM=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctNonDistinctAggregatesWithGrouping2.json b/tests/benchmark/testDistinctNonDistinctAggregatesWithGrouping2.json deleted file mode 100644 index ae6997d..0000000 --- a/tests/benchmark/testDistinctNonDistinctAggregatesWithGrouping2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":3,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT()], EXPR$2=[SUM(DISTINCT $1)])\n LogicalProject(DEPTNO=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($2)], EXPR$2=[SUM($1)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT()])\n LogicalProject(DEPTNO=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctNonDistinctTwoAggregatesWithGrouping.json b/tests/benchmark/testDistinctNonDistinctTwoAggregatesWithGrouping.json deleted file mode 100644 index 7fc4657..0000000 --- a/tests/benchmark/testDistinctNonDistinctTwoAggregatesWithGrouping.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL","COMM","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[SUM(DISTINCT $2)])\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($2)], EXPR$2=[MIN($3)], EXPR$3=[SUM($1)])\n LogicalAggregate(group=[{0, 2}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctWithDiffFiltersAndSameGroupSet.json b/tests/benchmark/testDistinctWithDiffFiltersAndSameGroupSet.json deleted file mode 100644 index 72c714e..0000000 --- a/tests/benchmark/testDistinctWithDiffFiltersAndSameGroupSet.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"500","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":0,"type":"BOOLEAN"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":1,"type":"BOOLEAN"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"500","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":0,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"source":{"project":{"target":[{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"500","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":2,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":7,"type":"INTEGER"},{"operator":"500","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":0,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"source":{"project":{"target":[{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"500","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"GROUPING","operand":[{"column":2,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":7,"type":"INTEGER"},{"operator":"500","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT(DISTINCT $0) FILTER $1], EXPR$1=[COUNT(DISTINCT $1) FILTER $0])\n LogicalProject(C=[>($5, 1000)], D=[<($5, 500)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[COUNT() FILTER $1], EXPR$1=[COUNT() FILTER $0])\n LogicalProject($g_0_f_0=[AND(=($2, 0), $0)], $g_0_f_1=[AND(=($2, 0), $1)])\n LogicalAggregate(group=[{0, 1}], $g=[GROUPING($0, $1)])\n LogicalProject(C=[>($5, 1000)], D=[<($5, 500)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctWithFilterAndGroupBy.json b/tests/benchmark/testDistinctWithFilterAndGroupBy.json deleted file mode 100644 index dceb4bc..0000000 --- a/tests/benchmark/testDistinctWithFilterAndGroupBy.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":3,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CAST","operand":[{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BOOLEAN"},{"column":6,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"operator":">","operand":[{"column":8,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":4,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"BOOLEAN"},{"column":7,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":10,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"operator":">","operand":[{"column":9,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT(DISTINCT $2) FILTER $3])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5], $f3=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[CAST($1):INTEGER NOT NULL], EXPR$2=[$2])\n LogicalAggregate(group=[{0}], EXPR$1=[MIN($2) FILTER $4], EXPR$2=[COUNT($1) FILTER $3])\n LogicalProject(DEPTNO=[$0], SAL=[$1], EXPR$1=[$3], $g_0_f_2=[AND(=($4, 0), IS TRUE($2))], $g_3=[=($4, 3)])\n LogicalAggregate(group=[{0, 2, 3}], groups=[[{0, 2, 3}, {0}]], EXPR$1=[SUM($1)], $g=[GROUPING($0, $2, $3)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5], $f3=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctWithFilterWithoutGroupBy.json b/tests/benchmark/testDistinctWithFilterWithoutGroupBy.json deleted file mode 100644 index e8560f1..0000000 --- a/tests/benchmark/testDistinctWithFilterWithoutGroupBy.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":1,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":4,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":4,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT(DISTINCT $1) FILTER $2])\n LogicalProject(COMM=[$6], SAL=[$5], $f2=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[MIN($1) FILTER $3], EXPR$1=[COUNT($0) FILTER $2])\n LogicalProject(SAL=[$0], EXPR$0=[$2], $g_0_f_1=[AND(=($3, 0), IS TRUE($1))], $g_3=[=($3, 3)])\n LogicalAggregate(group=[{1, 2}], groups=[[{1, 2}, {}]], EXPR$0=[SUM($0)], $g=[GROUPING($1, $2)])\n LogicalProject(COMM=[$6], SAL=[$5], $f2=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctWithGrouping.json b/tests/benchmark/testDistinctWithGrouping.json deleted file mode 100644 index 6a57cfa..0000000 --- a/tests/benchmark/testDistinctWithGrouping.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL","COMM"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[SUM(DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($2)], EXPR$3=[SUM($0)])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctWithMultipleInputs.json b/tests/benchmark/testDistinctWithMultipleInputs.json deleted file mode 100644 index 37f130e..0000000 --- a/tests/benchmark/testDistinctWithMultipleInputs.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL","COMM","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[COUNT(DISTINCT $2, $1)])\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($3)], EXPR$2=[MIN($4)], EXPR$3=[COUNT()])\n LogicalAggregate(group=[{0, 1, 2}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testDistinctWithMultipleInputsAndGroupby.json b/tests/benchmark/testDistinctWithMultipleInputsAndGroupby.json deleted file mode 100644 index c3547f4..0000000 --- a/tests/benchmark/testDistinctWithMultipleInputsAndGroupby.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL","COMM","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":3,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[COUNT(DISTINCT $2, $0, $1)])\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($3)], EXPR$2=[MIN($4)], EXPR$3=[COUNT()])\n LogicalAggregate(group=[{0, 1, 2}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalProject(DEPTNO=[$2], COMM=[$1], SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptyAggregate.json b/tests/benchmark/testEmptyAggregate.json deleted file mode 100644 index 008c698..0000000 --- a/tests/benchmark/testEmptyAggregate.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[]}}}}}}]}}}},{"values":{"schema":["INTEGER"],"content":[]}}],"help":["LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[SUM($1)])\n LogicalValues(tuples=[[]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json b/tests/benchmark/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json deleted file mode 100644 index e74a291..0000000 --- a/tests/benchmark/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"values":{"schema":["INTEGER"],"content":[]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER"],"content":[]}}}}}}]}},{"values":{"schema":["BIGINT","INTEGER"],"content":[[{"operator":"0","operand":[],"type":"BIGINT"},{"operator":"NULL","operand":[],"type":"INTEGER"}]]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT()], EXPR$1=[SUM($0)])\n LogicalValues(tuples=[[]])\n","LogicalValues(tuples=[[{ 0, null }]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptyFilterProjectUnion.json b/tests/benchmark/testEmptyFilterProjectUnion.json deleted file mode 100644 index eb34d81..0000000 --- a/tests/benchmark/testEmptyFilterProjectUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"20","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}]]}}}}]}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}}],"help":["LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>(+($0, $1), 30)])\n LogicalUnion(all=[true])\n LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 20, 2 }]])\n","LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptyIntersect.json b/tests/benchmark/testEmptyIntersect.json deleted file mode 100644 index 450c8cf..0000000 --- a/tests/benchmark/testEmptyIntersect.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"intersect":[{"intersect":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}}}}]},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}}]},{"values":{"schema":["INTEGER","INTEGER"],"content":[]}}],"help":["LogicalIntersect(all=[false])\n LogicalIntersect(all=[false])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 50)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptyMinus.json b/tests/benchmark/testEmptyMinus.json deleted file mode 100644 index 1e07111..0000000 --- a/tests/benchmark/testEmptyMinus.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"distinct":{"except":[{"distinct":{"except":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"20","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}]]}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"40","operand":[],"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}]]}}}}]}},{"values":{"schema":["INTEGER","INTEGER"],"content":[]}}],"help":["LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 30)])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 20, 2 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 40, 4 }]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptyMinus2.json b/tests/benchmark/testEmptyMinus2.json deleted file mode 100644 index 1458c81..0000000 --- a/tests/benchmark/testEmptyMinus2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"distinct":{"except":[{"distinct":{"except":[{"distinct":{"except":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"20","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}]]}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"40","operand":[],"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}]]}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"50","operand":[],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}]]}}}}}}]}},{"distinct":{"except":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"40","operand":[],"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}]]}}}}]}}],"help":["LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 30)])\n LogicalValues(tuples=[[{ 20, 2 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 40, 4 }]])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 50)])\n LogicalValues(tuples=[[{ 50, 5 }]])\n","LogicalMinus(all=[false])\n LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 40, 4 }]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptyProject.json b/tests/benchmark/testEmptyProject.json deleted file mode 100644 index f913a42..0000000 --- a/tests/benchmark/testEmptyProject.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"project":{"target":[{"operator":"+","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}}}},{"values":{"schema":["INTEGER"],"content":[]}}],"help":["LogicalProject(EXPR$0=[+(+($0, $1), $0)])\n LogicalFilter(condition=[>(+($0, $1), 50)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptyProject2.json b/tests/benchmark/testEmptyProject2.json deleted file mode 100644 index f913a42..0000000 --- a/tests/benchmark/testEmptyProject2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"project":{"target":[{"operator":"+","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}}}},{"values":{"schema":["INTEGER"],"content":[]}}],"help":["LogicalProject(EXPR$0=[+(+($0, $1), $0)])\n LogicalFilter(condition=[>(+($0, $1), 50)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptySort.json b/tests/benchmark/testEmptySort.json deleted file mode 100644 index 3ba1e8d..0000000 --- a/tests/benchmark/testEmptySort.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[7,"INTEGER","ASC"]],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}],"help":["LogicalSort(sort0=[$7], dir0=[ASC])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptySort2.json b/tests/benchmark/testEmptySort2.json deleted file mode 100644 index bd3c4b7..0000000 --- a/tests/benchmark/testEmptySort2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"sort":{"collation":[[1,"VARCHAR","ASC"],[0,"TINYINT","ASC"]],"source":{"values":{"schema":["TINYINT","VARCHAR","VARCHAR"],"content":[]}}}},{"values":{"schema":["TINYINT","VARCHAR","VARCHAR"],"content":[]}}],"help":["LogicalSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[ASC])\n LogicalValues(tuples=[[]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testEmptySortLimitZero.json b/tests/benchmark/testEmptySortLimitZero.json deleted file mode 100644 index 80496b5..0000000 --- a/tests/benchmark/testEmptySortLimitZero.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[7,"INTEGER","ASC"]],"limit":{"operator":"0","operand":[],"type":"INTEGER"},"source":{"scan":0}}},{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}],"help":["LogicalSort(sort0=[$7], dir0=[ASC], fetch=[0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExistsWithAtLeastOneRowSubQuery.json b/tests/benchmark/testExistsWithAtLeastOneRowSubQuery.json deleted file mode 100644 index 83782c6..0000000 --- a/tests/benchmark/testExistsWithAtLeastOneRowSubQuery.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"EXISTS","operand":[],"query":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}}]}},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"scan":0}],"help":["LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[EXISTS({\nLogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[0])\n LogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExistsWithNoRowSubQuery.json b/tests/benchmark/testExistsWithNoRowSubQuery.json deleted file mode 100644 index 8c50aae..0000000 --- a/tests/benchmark/testExistsWithNoRowSubQuery.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"NOT","operand":[{"operator":"EXISTS","operand":[],"query":{"values":{"schema":["BIGINT"],"content":[]}},"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"scan":0}],"help":["LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[NOT(EXISTS({\nLogicalValues(tuples=[[]])\n}))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandFilterExists.json b/tests/benchmark/testExpandFilterExists.json deleted file mode 100644 index cc98e10..0000000 --- a/tests/benchmark/testExpandFilterExists.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"EXISTS","operand":[],"query":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"type":"BOOLEAN"},{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IS NOT NULL","operand":[{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"}],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($1, 100))])\n LogicalProject(EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IS NOT NULL($2), <($1, 100))])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalProject(EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandFilterExistsSimple.json b/tests/benchmark/testExpandFilterExistsSimple.json deleted file mode 100644 index 78a1dd6..0000000 --- a/tests/benchmark/testExpandFilterExistsSimple.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"EXISTS","operand":[],"query":{"filter":{"condition":{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"}],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}],"help":["LogicalFilter(condition=[EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandFilterExistsSimpleAnd.json b/tests/benchmark/testExpandFilterExistsSimpleAnd.json deleted file mode 100644 index b083004..0000000 --- a/tests/benchmark/testExpandFilterExistsSimpleAnd.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"EXISTS","operand":[],"query":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"type":"BOOLEAN"},{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"}],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[AND(EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($1, 100))])\n LogicalProject(EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[<($1, 100)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandFilterIn.json b/tests/benchmark/testExpandFilterIn.json deleted file mode 100644 index 2c3e187..0000000 --- a/tests/benchmark/testExpandFilterIn.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IN","operand":[{"column":2,"type":"INTEGER"}],"query":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":3,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"},{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IS NOT NULL","operand":[{"column":4,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IN($2, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($1, 100))])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IS NOT NULL($4), <($1, 100))])\n LogicalJoin(condition=[=($2, $3)], joinType=[left])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$1], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandFilterIn3Value.json b/tests/benchmark/testExpandFilterIn3Value.json deleted file mode 100644 index 09bc055..0000000 --- a/tests/benchmark/testExpandFilterIn3Value.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"operator":"IN","operand":[{"column":1,"type":"INTEGER"}],"query":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":9,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"operator":"IN","operand":[{"column":1,"type":"INTEGER"}],"query":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":9,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"20","operand":[],"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"},{"operator":"IS NOT NULL","operand":[{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":3,"type":"BIGINT"},{"column":2,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"},{"operator":"IS NOT NULL","operand":[{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":3,"type":"BIGINT"},{"column":2,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"20","operand":[],"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BOOLEAN"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[<($0, CASE(=(IN($1, {\nLogicalProject(EXPR$0=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), true), 10, =(IN($1, {\nLogicalProject(EXPR$0=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), false), 20, 30))])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[<($0, CASE(=(CASE(=($2, 0), false, IS NOT NULL($5), true, <($3, $2), null:BOOLEAN, false), true), 10, =(CASE(=($2, 0), false, IS NOT NULL($5), true, <($3, $2), null:BOOLEAN, false), false), 20, 30))])\n LogicalJoin(condition=[=($1, $4)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(EXPR$0=[CASE(true, CAST($1):INTEGER, null:INTEGER)])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(EXPR$0=[CASE(true, CAST($1):INTEGER, null:INTEGER)], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandFilterInComposite.json b/tests/benchmark/testExpandFilterInComposite.json deleted file mode 100644 index b0bbef9..0000000 --- a/tests/benchmark/testExpandFilterInComposite.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IN","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"query":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":3,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"},{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IS NOT NULL","operand":[{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IN($0, $2, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($1, 100))])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IS NOT NULL($5), <($1, 100))])\n LogicalJoin(condition=[AND(=($0, $3), =($2, $4))], joinType=[left])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], DEPTNO=[$1], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandFilterScalar.json b/tests/benchmark/testExpandFilterScalar.json deleted file mode 100644 index bdde2bb..0000000 --- a/tests/benchmark/testExpandFilterScalar.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"<","operand":[{"operator":"$SCALAR_QUERY","operand":[],"query":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"INTEGER"},{"operator":"$SCALAR_QUERY","operand":[],"query":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"SINGLE_VALUE","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"SINGLE_VALUE","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(<($SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), $SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})), <($1, 100))])\n LogicalProject(EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(<($2, $3), <($1, 100))])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalProject(EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandJoinExists.json b/tests/benchmark/testExpandJoinExists.json deleted file mode 100644 index 4984ac3..0000000 --- a/tests/benchmark/testExpandJoinExists.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"EXISTS","operand":[],"query":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":1}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"}],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], joinType=[left])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandJoinScalar.json b/tests/benchmark/testExpandJoinScalar.json deleted file mode 100644 index d2eb645..0000000 --- a/tests/benchmark/testExpandJoinScalar.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"<","operand":[{"operator":"$SCALAR_QUERY","operand":[],"query":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"INTEGER"},{"operator":"$SCALAR_QUERY","operand":[],"query":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"join":{"kind":"LEFT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":1}}},"right":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"SINGLE_VALUE","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"SINGLE_VALUE","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[<($SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), $SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], joinType=[left])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[<($2, $3)], joinType=[left])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandProjectExists.json b/tests/benchmark/testExpandProjectExists.json deleted file mode 100644 index 97f1f6c..0000000 --- a/tests/benchmark/testExpandProjectExists.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"EXISTS","operand":[],"query":{"filter":{"condition":{"operator":"<","operand":[{"column":9,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"type":"BOOLEAN"}],"source":{"scan":0}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"IS NOT NULL","operand":[{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"}],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}],"help":["LogicalProject(EMPNO=[$0], D=[EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], D=[IS NOT NULL($1)])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandProjectIn.json b/tests/benchmark/testExpandProjectIn.json deleted file mode 100644 index 79c2d57..0000000 --- a/tests/benchmark/testExpandProjectIn.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"IN","operand":[{"column":7,"type":"INTEGER"}],"query":{"project":{"target":[{"column":16,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":9,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"}],"source":{"scan":0}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}],"help":["LogicalProject(EMPNO=[$0], D=[IN($7, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], D=[CASE(IS NOT NULL($3), true, false)])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$1], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandProjectInComposite.json b/tests/benchmark/testExpandProjectInComposite.json deleted file mode 100644 index d54493c..0000000 --- a/tests/benchmark/testExpandProjectInComposite.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"IN","operand":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"query":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":9,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"}],"source":{"scan":0}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"column":4,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], D=[IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], D=[CASE(IS NOT NULL($4), true, false)])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], DEPTNO=[$1], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandProjectInNullable.json b/tests/benchmark/testExpandProjectInNullable.json deleted file mode 100644 index 90ce85d..0000000 --- a/tests/benchmark/testExpandProjectInNullable.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"IN","operand":[{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":7,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"query":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":9,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":16,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}},"type":"BOOLEAN"}],"source":{"scan":0}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BOOLEAN"},{"operator":"IS NOT NULL","operand":[{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":3,"type":"BIGINT"},{"column":2,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":7,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":7,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":7,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":9,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}}],"help":["LogicalProject(EMPNO=[$0], D=[IN(CASE(true, CAST($7):INTEGER, null:INTEGER), {\nLogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], D=[CASE(=($2, 0), false, IS NULL(CASE(true, CAST($1):INTEGER, null:INTEGER)), null:BOOLEAN, IS NOT NULL($5), true, <($3, $2), null:BOOLEAN, false)])\n LogicalJoin(condition=[=(CASE(true, CAST($1):INTEGER, null:INTEGER), $4)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$1], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandProjectScalar.json b/tests/benchmark/testExpandProjectScalar.json deleted file mode 100644 index 4f7e97c..0000000 --- a/tests/benchmark/testExpandProjectScalar.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"$SCALAR_QUERY","operand":[],"query":{"project":{"target":[{"column":16,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":9,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"INTEGER"}],"source":{"scan":0}}},{"join":{"kind":"LEFT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"SINGLE_VALUE","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}],"help":["LogicalProject(EMPNO=[$0], D=[$SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalJoin(condition=[true], joinType=[left])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpandWhereComparisonCorrelated.json b/tests/benchmark/testExpandWhereComparisonCorrelated.json deleted file mode 100644 index 24ab623..0000000 --- a/tests/benchmark/testExpandWhereComparisonCorrelated.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"$SCALAR_QUERY","operand":[],"query":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":7,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":7,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":14,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":9,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":14,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=($1, $SCALAR_QUERY({\nLogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(SAL=[$5])\n LogicalFilter(condition=[=($0, $cor0.EMPNO)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalProject(EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=($5, $9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(SAL=[$1])\n LogicalFilter(condition=[=($0, $cor0.EMPNO)])\n LogicalProject(EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpressionSimplification1.json b/tests/benchmark/testExpressionSimplification1.json deleted file mode 100644 index ee84132..0000000 --- a/tests/benchmark/testExpressionSimplification1.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"<>","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1''","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'3'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":1,"type":"VARCHAR"},{"operator":"Sarg[(-∞.._ISO-8859-1''), (_ISO-8859-1''.._ISO-8859-1'3'), (_ISO-8859-1'3'..+∞)]","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(<>($1, ''), <>($1, '3'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[SEARCH($1, Sarg[(-∞..'':VARCHAR(20)), ('':VARCHAR(20)..'3':VARCHAR(20)), ('3':VARCHAR(20)..+∞)]:VARCHAR(20))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExpressionSimplification2.json b/tests/benchmark/testExpressionSimplification2.json deleted file mode 100644 index 50803bc..0000000 --- a/tests/benchmark/testExpressionSimplification2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"OR","operand":[{"operator":"<","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1''","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1''","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"OR","operand":[{"operator":"<","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'3'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'3'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":1,"type":"VARCHAR"},{"operator":"Sarg[(-∞.._ISO-8859-1''), (_ISO-8859-1''.._ISO-8859-1'3'), (_ISO-8859-1'3'..+∞)]","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(OR(<($1, ''), >($1, '')), OR(<($1, '3'), >($1, '3')))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[SEARCH($1, Sarg[(-∞..'':CHAR(1)), ('':CHAR(1)..'3'), ('3'..+∞)]:CHAR(1))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExtractJoinFilterRule.json b/tests/benchmark/testExtractJoinFilterRule.json deleted file mode 100644 index 28f1d3c..0000000 --- a/tests/benchmark/testExtractJoinFilterRule.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[=($0, $1)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExtractYearMonthToRange.json b/tests/benchmark/testExtractYearMonthToRange.json deleted file mode 100644 index 6555a4b..0000000 --- a/tests/benchmark/testExtractYearMonthToRange.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP_B","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER","BIRTHDATE"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN","DATE"],"nullable":[false,false,false,true,false,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"DATE"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"operator":"EXTRACT","operand":[{"operator":"YEAR","operand":[],"type":"SYMBOL"},{"column":9,"type":"DATE"}],"type":"BIGINT"},{"operator":"2014","operand":[],"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"operator":"EXTRACT","operand":[{"operator":"MONTH","operand":[],"type":"SYMBOL"},{"column":9,"type":"DATE"}],"type":"BIGINT"},{"operator":"4","operand":[],"type":"BIGINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"DATE"}],"source":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":9,"type":"DATE"},{"operator":"Sarg[[2014-04-01..2014-05-01)]","operand":[],"type":"DATE"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[AND(=(EXTRACT(FLAG(YEAR), $9), 2014), =(EXTRACT(FLAG(MONTH), $9), 4))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[SEARCH($9, Sarg[[2014-04-01..2014-05-01)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testExtractYearToRange.json b/tests/benchmark/testExtractYearToRange.json deleted file mode 100644 index 81e2311..0000000 --- a/tests/benchmark/testExtractYearToRange.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP_B","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER","BIRTHDATE"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN","DATE"],"nullable":[false,false,false,true,false,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"DATE"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"EXTRACT","operand":[{"operator":"YEAR","operand":[],"type":"SYMBOL"},{"column":9,"type":"DATE"}],"type":"BIGINT"},{"operator":"2014","operand":[],"type":"BIGINT"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"DATE"}],"source":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":9,"type":"DATE"},{"operator":"Sarg[[2014-01-01..2015-01-01)]","operand":[],"type":"DATE"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[=(EXTRACT(FLAG(YEAR), $9), 2014)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[SEARCH($9, Sarg[[2014-01-01..2015-01-01)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testFilterJoinRuleAndIsNotNull.json b/tests/benchmark/testFilterJoinRuleAndIsNotNull.json deleted file mode 100644 index 7a366da..0000000 --- a/tests/benchmark/testFilterJoinRuleAndIsNotNull.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NOT NULL","operand":[{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT NULL","operand":[{"column":10,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":9,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"column":10,"type":"VARCHAR"}],"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalFilter(condition=[AND(IS NOT NULL($9), IS NOT NULL($10))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[CAST($9):INTEGER], NAME=[CAST($10):VARCHAR(10)])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testFilterJoinRuleOrIsNotNull.json b/tests/benchmark/testFilterJoinRuleOrIsNotNull.json deleted file mode 100644 index 45c85fd..0000000 --- a/tests/benchmark/testFilterJoinRuleOrIsNotNull.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IS NOT NULL","operand":[{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT NULL","operand":[{"column":10,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":9,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"column":10,"type":"VARCHAR"}],"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalFilter(condition=[OR(IS NOT NULL($9), IS NOT NULL($10))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[CAST($9):INTEGER], NAME=[CAST($10):VARCHAR(10)])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testFilterProjectTranspose.json b/tests/benchmark/testFilterProjectTranspose.json deleted file mode 100644 index 973054f..0000000 --- a/tests/benchmark/testFilterProjectTranspose.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":9,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"*","operand":[{"column":9,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":9,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"*","operand":[{"column":9,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}]}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":9,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"*","operand":[{"column":9,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":9,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"*","operand":[{"column":9,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}]}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalProject(TWICEDEPTNO=[*($0, 2)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, *($0, 2))])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testFilterRemoveIsNotDistinctFromRule.json b/tests/benchmark/testFilterRemoveIsNotDistinctFromRule.json deleted file mode 100644 index a5a813d..0000000 --- a/tests/benchmark/testFilterRemoveIsNotDistinctFromRule.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO"],"types":["SMALLINT","VARCHAR","VARCHAR","SMALLINT","DATE","DECIMAL","DECIMAL","TINYINT"],"nullable":[false,true,true,true,true,true,true,true],"key":[[0],[1]],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"IS NOT DISTINCT FROM","operand":[{"column":7,"type":"TINYINT"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"TINYINT"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}],"help":["LogicalFilter(condition=[IS NOT DISTINCT FROM($7, 20)])\n LogicalTableScan(table=[[scott, EMP]])\n","LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[scott, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testFlattenUncorrelatedCallBelowEquals.json b/tests/benchmark/testFlattenUncorrelatedCallBelowEquals.json deleted file mode 100644 index 1dcd63a..0000000 --- a/tests/benchmark/testFlattenUncorrelatedCallBelowEquals.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":9,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"column":9,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":9,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"column":9,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":9,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"+","operand":[{"column":16,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":9,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"+","operand":[{"column":16,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, +($0, 30))])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalProject($f9=[+($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json b/tests/benchmark/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json deleted file mode 100644 index e6b1cf9..0000000 --- a/tests/benchmark/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":9,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":9,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":9,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"+","operand":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":9,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"+","operand":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, +(*(2, $0), 30))])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalProject($f9=[+(*(2, $7), 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testFullOuterJoinSimplificationToInner.json b/tests/benchmark/testFullOuterJoinSimplificationToInner.json deleted file mode 100644 index 5e1aa09..0000000 --- a/tests/benchmark/testFullOuterJoinSimplificationToInner.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[AND(=($1, 'Charlie'), >($2, 100))])\n LogicalJoin(condition=[=($0, $3)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testFullOuterJoinSimplificationToLeftOuter.json b/tests/benchmark/testFullOuterJoinSimplificationToLeftOuter.json deleted file mode 100644 index bdbd37e..0000000 --- a/tests/benchmark/testFullOuterJoinSimplificationToLeftOuter.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalJoin(condition=[=($0, $2)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testFullOuterJoinSimplificationToRightOuter.json b/tests/benchmark/testFullOuterJoinSimplificationToRightOuter.json deleted file mode 100644 index 371f13f..0000000 --- a/tests/benchmark/testFullOuterJoinSimplificationToRightOuter.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($1, 100)])\n LogicalJoin(condition=[=($0, $2)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testGroupByBooleanLiteralSimple.json b/tests/benchmark/testGroupByBooleanLiteralSimple.json deleted file mode 100644 index e5c5c62..0000000 --- a/tests/benchmark/testGroupByBooleanLiteralSimple.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"}],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":1,"type":"BOOLEAN"},{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"values":{"schema":["BOOLEAN"],"content":[[{"operator":"true","operand":[],"type":"BOOLEAN"}]]}}}}}}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"BOOLEAN"},{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"values":{"schema":["BOOLEAN"],"content":[[{"operator":"true","operand":[],"type":"BOOLEAN"}]]}}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[true], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[$1], SAL=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[{ true }]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testGroupByDateLiteralSimple.json b/tests/benchmark/testGroupByDateLiteralSimple.json deleted file mode 100644 index 97fed96..0000000 --- a/tests/benchmark/testGroupByDateLiteralSimple.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"DATE"}],"source":{"project":{"target":[{"operator":"java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]","operand":[],"type":"DATE"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"DATE"},{"column":1,"type":"DATE"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]","operand":[],"type":"DATE"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"DATE"}],"source":{"project":{"target":[{"column":1,"type":"DATE"},{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"values":{"schema":["DATE"],"content":[[{"operator":"java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]","operand":[],"type":"DATE"}]]}}}}}}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"DATE"},{"column":1,"type":"DATE"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"DATE"},{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"values":{"schema":["DATE"],"content":[[{"operator":"java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]","operand":[],"type":"DATE"}]]}}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[2022-01-01], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[$1], SAL=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[{ 2022-01-01 }]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testGroupByMultipleLiterals.json b/tests/benchmark/testGroupByMultipleLiterals.json deleted file mode 100644 index ea0b901..0000000 --- a/tests/benchmark/testGroupByMultipleLiterals.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":6,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BOOLEAN"},{"column":3,"type":"INTEGER"},{"column":4,"type":"CHAR"},{"column":5,"type":"DATE"}],"source":{"project":{"target":[{"operator":"false","operand":[],"type":"BOOLEAN"},{"column":7,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"column":0,"type":"INTEGER"},{"operator":"_ISO-8859-1'ab'","operand":[],"type":"CHAR"},{"operator":"java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]","operand":[],"type":"DATE"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":12,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":6,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BOOLEAN"},{"column":8,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"CHAR"},{"column":10,"type":"CHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"DATE"},{"column":11,"type":"DATE"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"false","operand":[],"type":"BOOLEAN"},{"column":13,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"column":6,"type":"INTEGER"},{"operator":"_ISO-8859-1'ab'","operand":[],"type":"CHAR"},{"operator":"java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]","operand":[],"type":"DATE"},{"column":11,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":6,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"BOOLEAN"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BOOLEAN"},{"column":3,"type":"INTEGER"},{"column":4,"type":"CHAR"},{"column":5,"type":"DATE"}],"source":{"project":{"target":[{"column":3,"type":"BOOLEAN"},{"column":2,"type":"INTEGER"},{"column":4,"type":"BOOLEAN"},{"column":0,"type":"INTEGER"},{"column":5,"type":"CHAR"},{"column":6,"type":"DATE"},{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"values":{"schema":["BOOLEAN","BOOLEAN","CHAR","DATE"],"content":[[{"operator":"false","operand":[],"type":"BOOLEAN"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'ab'","operand":[],"type":"CHAR"},{"operator":"java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]","operand":[],"type":"DATE"}]]}}}}}}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":12,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"BOOLEAN"},{"column":6,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BOOLEAN"},{"column":8,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"CHAR"},{"column":10,"type":"CHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"DATE"},{"column":11,"type":"DATE"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"BOOLEAN"},{"column":8,"type":"INTEGER"},{"column":10,"type":"BOOLEAN"},{"column":6,"type":"INTEGER"},{"column":11,"type":"CHAR"},{"column":12,"type":"DATE"},{"column":7,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":11,"type":"INTEGER"},{"column":13,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"values":{"schema":["BOOLEAN","BOOLEAN","CHAR","DATE"],"content":[[{"operator":"false","operand":[],"type":"BOOLEAN"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'ab'","operand":[],"type":"CHAR"},{"operator":"java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]","operand":[],"type":"DATE"}]]}}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$6])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5}], EXPR$0=[AVG($6)])\n LogicalProject($f0=[false], DEPTNO=[$7], $f2=[true], EMPNO=[$0], $f4=['ab'], $f5=[2022-01-01], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$6])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5}], EXPR$0=[AVG($6)])\n LogicalProject($f0=[$3], DEPTNO=[$2], $f2=[$4], EMPNO=[$0], $f4=[$5], $f5=[$6], SAL=[$1])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[{ false, true, 'ab', 2022-01-01 }]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testInferringPredicatesWithNotOperatorInJoinCondition.json b/tests/benchmark/testInferringPredicatesWithNotOperatorInJoinCondition.json deleted file mode 100644 index 9902278..0000000 --- a/tests/benchmark/testInferringPredicatesWithNotOperatorInJoinCondition.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":16,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NOT","operand":[{"operator":"OR","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"6","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":16,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"NOT","operand":[{"operator":"OR","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"6","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":7,"type":"INTEGER"},{"operator":"Sarg[(-∞..4), (4..6), (6..+∞)]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[AND(=($16, $7), NOT(OR(=($7, 4), =($7, 6))))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[=($16, $7)], joinType=[inner])\n LogicalFilter(condition=[NOT(OR(=($7, 4), =($7, 6)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[SEARCH($7, Sarg[(-∞..4), (4..6), (6..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testIntersectToDistinct.json b/tests/benchmark/testIntersectToDistinct.json deleted file mode 100644 index 8960543..0000000 --- a/tests/benchmark/testIntersectToDistinct.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"intersect":[{"intersect":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"3","operand":[],"type":"BIGINT"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":10,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"TIMESTAMP"},{"column":13,"type":"TIMESTAMP"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"column":14,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":6,"type":"INTEGER"},{"column":15,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":8,"type":"BOOLEAN"},{"column":17,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":16,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":16,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":16,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}]}}}}}}],"help":["LogicalIntersect(all=[false])\n LogicalIntersect(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($9, 3)])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5, 6, 7, 8}], agg#0=[COUNT()])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testIsNullPushDown.json b/tests/benchmark/testIsNullPushDown.json deleted file mode 100644 index 25601c4..0000000 --- a/tests/benchmark/testIsNullPushDown.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"values":{"schema":["INTEGER","INTEGER","BIGINT"],"content":[]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"source":{"values":{"schema":["INTEGER","INTEGER","BIGINT"],"content":[]}}}}],"help":["LogicalValues(tuples=[[]])\n","LogicalProject(EMPNO=[$0], DEPTNO=[$1], W_COUNT=[$2])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testIsNullPushDown2.json b/tests/benchmark/testIsNullPushDown2.json deleted file mode 100644 index 25601c4..0000000 --- a/tests/benchmark/testIsNullPushDown2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"values":{"schema":["INTEGER","INTEGER","BIGINT"],"content":[]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"source":{"values":{"schema":["INTEGER","INTEGER","BIGINT"],"content":[]}}}}],"help":["LogicalValues(tuples=[[]])\n","LogicalProject(EMPNO=[$0], DEPTNO=[$1], W_COUNT=[$2])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json b/tests/benchmark/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json deleted file mode 100644 index 064ba09..0000000 --- a/tests/benchmark/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO"],"types":["SMALLINT","VARCHAR","VARCHAR","SMALLINT","DATE","DECIMAL","DECIMAL","TINYINT"],"nullable":[false,true,true,true,true,true,true,true],"key":[[0],[1]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","DNAME","LOC"],"types":["TINYINT","VARCHAR","VARCHAR"],"nullable":[false,true,true],"key":[[0],[1],[2]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME","JOB","SAL","COMM"],"types":["VARCHAR","VARCHAR","DECIMAL","DECIMAL"],"nullable":[true,true,true,true],"key":[[0],[1],[2],[3]],"foreign":[],"guaranteed":[]}],"queries":[{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":12,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"TINYINT"},{"column":8,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":2}}},{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":12,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"TINYINT"},{"column":8,"type":"TINYINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":1},"right":{"scan":2}}}}}],"help":["LogicalJoin(condition=[=($2, $12)], joinType=[inner])\n LogicalJoin(condition=[=($7, $8)], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, BONUS]])\n","LogicalJoin(condition=[AND(=($2, $12), =($7, $8))], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json b/tests/benchmark/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json deleted file mode 100644 index 386c5a5..0000000 --- a/tests/benchmark/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO"],"types":["SMALLINT","VARCHAR","VARCHAR","SMALLINT","DATE","DECIMAL","DECIMAL","TINYINT"],"nullable":[false,true,true,true,true,true,true,true],"key":[[0],[1]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME","JOB","SAL","COMM"],"types":["VARCHAR","VARCHAR","DECIMAL","DECIMAL"],"nullable":[true,true,true,true],"key":[[0],[1],[2],[3]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","DNAME","LOC"],"types":["TINYINT","VARCHAR","VARCHAR"],"nullable":[false,true,true],"key":[[0],[1],[2]],"foreign":[],"guaranteed":[]}],"queries":[{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"TINYINT"},{"column":12,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":2}}},{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"TINYINT"},{"column":12,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":1},"right":{"scan":2}}}}}],"help":["LogicalJoin(condition=[=($7, $12)], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, BONUS]])\n LogicalTableScan(table=[[scott, DEPT]])\n","LogicalJoin(condition=[=($7, $12)], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, BONUS]])\n LogicalTableScan(table=[[scott, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json b/tests/benchmark/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json deleted file mode 100644 index e89741a..0000000 --- a/tests/benchmark/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO"],"types":["SMALLINT","VARCHAR","VARCHAR","SMALLINT","DATE","DECIMAL","DECIMAL","TINYINT"],"nullable":[false,true,true,true,true,true,true,true],"key":[[0],[1]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","DNAME","LOC"],"types":["TINYINT","VARCHAR","VARCHAR"],"nullable":[false,true,true],"key":[[0],[1],[2]],"foreign":[],"guaranteed":[]}],"queries":[{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},{"project":{"target":[{"column":3,"type":"SMALLINT"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"},{"column":6,"type":"SMALLINT"},{"column":7,"type":"DATE"},{"column":8,"type":"DECIMAL"},{"column":9,"type":"DECIMAL"},{"column":10,"type":"TINYINT"},{"column":0,"type":"TINYINT"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":1},"right":{"scan":0}}}}}],"help":["LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, DEPT]])\n","LogicalProject(EMPNO=[$3], ENAME=[$4], JOB=[$5], MGR=[$6], HIREDATE=[$7], SAL=[$8], COMM=[$9], DEPTNO=[$10], DEPTNO0=[$0], DNAME=[$1], LOC=[$2])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinConditionPushdown1.json b/tests/benchmark/testJoinConditionPushdown1.json deleted file mode 100644 index 09eb1ad..0000000 --- a/tests/benchmark/testJoinConditionPushdown1.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"},{"column":18,"type":"INTEGER"},{"column":19,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":18,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":16,"type":"INTEGER"},{"column":18,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"},{"column":18,"type":"INTEGER"},{"column":19,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":18,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17], DEPTNO1=[$18], NAME=[$19])\n LogicalFilter(condition=[AND(=($7, $18), =($16, $18))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17], DEPTNO1=[$18], NAME=[$19])\n LogicalJoin(condition=[=($7, $18)], joinType=[inner])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinConditionPushdown2.json b/tests/benchmark/testJoinConditionPushdown2.json deleted file mode 100644 index 51137f1..0000000 --- a/tests/benchmark/testJoinConditionPushdown2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalFilter(condition=[AND(=($7, $9), =($0, $9))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalFilter(condition=[=($7, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinConditionPushdown4.json b/tests/benchmark/testJoinConditionPushdown4.json deleted file mode 100644 index 4a213b9..0000000 --- a/tests/benchmark/testJoinConditionPushdown4.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["SMALLINT","TINYINT"],"nullable":[false,true],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","DNAME"],"types":["TINYINT","VARCHAR"],"nullable":[false,true],"key":[[0],[1]],"foreign":[],"guaranteed":[]}],"queries":[{"join":{"kind":"SEMI","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":1,"type":"TINYINT"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"TINYINT"}],"source":{"scan":0}}},"right":{"scan":1}}},{"project":{"target":[{"column":1,"type":"TINYINT"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":1,"type":"TINYINT"},{"column":2,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}],"help":["LogicalJoin(condition=[AND(=($0, $1), =($0, $2))], joinType=[semi])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, DEPT]])\n","LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalFilter(condition=[=($0, $1)])\n LogicalTableScan(table=[[scott, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinConditionPushdown6.json b/tests/benchmark/testJoinConditionPushdown6.json deleted file mode 100644 index 8c5a1e2..0000000 --- a/tests/benchmark/testJoinConditionPushdown6.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[AND(=($7, $9), =($0, $9))], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalFilter(condition=[=($7, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinDeriveIsNotNullFilterRule1.json b/tests/benchmark/testJoinDeriveIsNotNullFilterRule1.json deleted file mode 100644 index 2798dac..0000000 --- a/tests/benchmark/testJoinDeriveIsNotNullFilterRule1.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["MGR","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[true,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(MGR=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalProject(MGR=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinDeriveIsNotNullFilterRule12.json b/tests/benchmark/testJoinDeriveIsNotNullFilterRule12.json deleted file mode 100644 index c676120..0000000 --- a/tests/benchmark/testJoinDeriveIsNotNullFilterRule12.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMPNULLABLES","fields":["ENAME","MGR","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[true,true,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"IS NOT DISTINCT FROM","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"IS NOT DISTINCT FROM","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(DEPTNO=[$2])\n LogicalJoin(condition=[AND(=($0, $3), IS NOT DISTINCT FROM($1, $4))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalProject(ENAME=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n","LogicalProject(DEPTNO=[$2])\n LogicalJoin(condition=[AND(=($0, $3), IS NOT DISTINCT FROM($1, $4))], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalProject(ENAME=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinDeriveIsNotNullFilterRule2.json b/tests/benchmark/testJoinDeriveIsNotNullFilterRule2.json deleted file mode 100644 index 745a383..0000000 --- a/tests/benchmark/testJoinDeriveIsNotNullFilterRule2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["MGR","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[true,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(MGR=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalProject(MGR=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinDeriveIsNotNullFilterRule3.json b/tests/benchmark/testJoinDeriveIsNotNullFilterRule3.json deleted file mode 100644 index 4706a91..0000000 --- a/tests/benchmark/testJoinDeriveIsNotNullFilterRule3.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["MGR","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[true,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[>($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(MGR=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[>($0, $2)], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalProject(MGR=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinDeriveIsNotNullFilterRule4.json b/tests/benchmark/testJoinDeriveIsNotNullFilterRule4.json deleted file mode 100644 index 7ad5aad..0000000 --- a/tests/benchmark/testJoinDeriveIsNotNullFilterRule4.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMPNULLABLES","fields":["ENAME","MGR","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[true,true,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NOT NULL","operand":[{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"IS NOT NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NOT NULL","operand":[{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"IS NOT NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(DEPTNO=[$2])\n LogicalJoin(condition=[AND(=($0, $3), >($1, $4))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalProject(ENAME=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n","LogicalProject(DEPTNO=[$2])\n LogicalJoin(condition=[AND(=($0, $3), >($1, $4))], joinType=[inner])\n LogicalFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])\n LogicalProject(ENAME=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinDeriveIsNotNullFilterRule5.json b/tests/benchmark/testJoinDeriveIsNotNullFilterRule5.json deleted file mode 100644 index 4e642c7..0000000 --- a/tests/benchmark/testJoinDeriveIsNotNullFilterRule5.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMPNULLABLES","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[true,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$0], DEPTNO=[+($1, 1)])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n","LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$0], DEPTNO=[+($1, 1)])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[IS NOT NULL($0)])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinProjectTranspose1.json b/tests/benchmark/testJoinProjectTranspose1.json deleted file mode 100644 index 3fa042a..0000000 --- a/tests/benchmark/testJoinProjectTranspose1.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"column":1,"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"column":1,"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"project":{"target":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}],"help":["LogicalProject(NAME=[$0])\n LogicalJoin(condition=[$1], joinType=[right])\n LogicalProject(NAME=[$0], $f4=[$2])\n LogicalJoin(condition=[$1], joinType=[left])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject($f2=[>($0, 10)], $f4=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0])\n LogicalJoin(condition=[>($1, 10)], joinType=[right])\n LogicalJoin(condition=[>($1, 10)], joinType=[left])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinProjectTranspose7.json b/tests/benchmark/testJoinProjectTranspose7.json deleted file mode 100644 index 64cc274..0000000 --- a/tests/benchmark/testJoinProjectTranspose7.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}}],"help":["LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinProjectTranspose8.json b/tests/benchmark/testJoinProjectTranspose8.json deleted file mode 100644 index aa419d3..0000000 --- a/tests/benchmark/testJoinProjectTranspose8.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}}}}],"help":["LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$2], EXPR$1=[$3])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], EXPR$1=[AND(>($0, 10), null)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$2], EXPR$1=[$3])\n LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$3], EXPR$1=[AND(>($2, 10), null)])\n LogicalJoin(condition=[=($1, $3)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinProjectTransposeWindow.json b/tests/benchmark/testJoinProjectTransposeWindow.json deleted file mode 100644 index 57b8d48..0000000 --- a/tests/benchmark/testJoinProjectTransposeWindow.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"BIGINT"},{"column":4,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"operator":"CAST","operand":[{"column":1,"type":"VARCHAR"}],"type":"BIGINT"}],"source":{"scan":0}}},"right":{"project":{"target":[{"error":"Not implemented: RANK"},{"operator":"+","operand":[{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"operator":"CAST","operand":[{"column":1,"type":"VARCHAR"}],"type":"BIGINT"},{"column":2,"type":"BIGINT"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"error":"Not implemented: RANK"},{"operator":"+","operand":[{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}],"help":["LogicalProject(DEPTNO=[$0], NAME=[$1], R=[$3], EXPR$1=[$4])\n LogicalJoin(condition=[=($2, $3)], joinType=[inner])\n LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[CAST($1):BIGINT NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(R=[RANK() OVER (ORDER BY $1)], EXPR$1=[+(1, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalJoin(condition=[=(CAST($1):BIGINT NOT NULL, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(R=[RANK() OVER (ORDER BY $1)], EXPR$1=[+(1, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testJoinPushTransitivePredicatesRule2.json b/tests/benchmark/testJoinPushTransitivePredicatesRule2.json deleted file mode 100644 index 7e8c1b5..0000000 --- a/tests/benchmark/testJoinPushTransitivePredicatesRule2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMPNULLABLES","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[true,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":4,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"OR","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BOOLEAN"},{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"OR","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":4,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BOOLEAN"},{"column":6,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":6,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}}}}]}}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":4,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},"right":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"OR","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"BOOLEAN"},{"column":3,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"BOOLEAN"},{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"OR","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":4,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BOOLEAN"},{"column":6,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":6,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}}}}]}}}}}}}}],"help":["LogicalProject(SAL=[$0])\n LogicalJoin(condition=[AND(=($0, $3), =($1, $4))], joinType=[inner])\n LogicalProject(SAL=[$0], $f9=[=($0, 4)])\n LogicalFilter(condition=[AND(=($1, 20), >($0, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[=($1, $0)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalJoin(condition=[OR(=($1, $0), $2)], joinType=[inner])\n LogicalProject(SAL=[$0])\n LogicalFilter(condition=[AND(=($1, 20), >($0, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(SAL=[$0], $f9=[=($0, 4)])\n LogicalFilter(condition=[AND(=($1, 20), >($0, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n","LogicalProject(SAL=[$0])\n LogicalJoin(condition=[AND(=($0, $3), =($1, $4))], joinType=[inner])\n LogicalFilter(condition=[>($0, 1000)])\n LogicalProject(SAL=[$0], $f9=[=($0, 4)])\n LogicalFilter(condition=[AND(=($1, 20), >($0, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[=($1, $0)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalJoin(condition=[OR(=($1, $0), $2)], joinType=[inner])\n LogicalProject(SAL=[$0])\n LogicalFilter(condition=[AND(=($1, 20), >($0, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(SAL=[$0], $f9=[=($0, 4)])\n LogicalFilter(condition=[AND(=($1, 20), >($0, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testLeftEmptyAntiJoin.json b/tests/benchmark/testLeftEmptyAntiJoin.json deleted file mode 100644 index b6688d1..0000000 --- a/tests/benchmark/testLeftEmptyAntiJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["TINYINT"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"join":{"kind":"ANTI","condition":{"operator":"=","operand":[{"column":7,"type":"TINYINT"},{"column":8,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"values":{"schema":["SMALLINT","VARCHAR","VARCHAR","SMALLINT","DATE","DECIMAL","DECIMAL","TINYINT"],"content":[]}},"right":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"values":{"schema":["SMALLINT","VARCHAR","VARCHAR","SMALLINT","DATE","DECIMAL","DECIMAL","TINYINT"],"content":[]}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($7, $8)], joinType=[anti])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[scott, DEPT]])\n","LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testLeftEmptyFullJoin.json b/tests/benchmark/testLeftEmptyFullJoin.json deleted file mode 100644 index ad1ee5d..0000000 --- a/tests/benchmark/testLeftEmptyFullJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}},"right":{"scan":1}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testLeftEmptyInnerJoin.json b/tests/benchmark/testLeftEmptyInnerJoin.json deleted file mode 100644 index b585118..0000000 --- a/tests/benchmark/testLeftEmptyInnerJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN","INTEGER","VARCHAR"],"content":[]}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testLeftEmptyLeftJoin.json b/tests/benchmark/testLeftEmptyLeftJoin.json deleted file mode 100644 index 330534a..0000000 --- a/tests/benchmark/testLeftEmptyLeftJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN","INTEGER","VARCHAR"],"content":[]}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testLeftEmptyRightJoin.json b/tests/benchmark/testLeftEmptyRightJoin.json deleted file mode 100644 index 8fd8c69..0000000 --- a/tests/benchmark/testLeftEmptyRightJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}},"right":{"scan":1}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testLeftEmptySemiJoin.json b/tests/benchmark/testLeftEmptySemiJoin.json deleted file mode 100644 index 403953a..0000000 --- a/tests/benchmark/testLeftEmptySemiJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["TINYINT"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":7,"type":"TINYINT"},{"column":8,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"values":{"schema":["SMALLINT","VARCHAR","VARCHAR","SMALLINT","DATE","DECIMAL","DECIMAL","TINYINT"],"content":[]}},"right":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"values":{"schema":["SMALLINT","VARCHAR","VARCHAR","SMALLINT","DATE","DECIMAL","DECIMAL","TINYINT"],"content":[]}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($7, $8)], joinType=[semi])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[scott, DEPT]])\n","LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testLeftOuterJoinSimplificationToInner.json b/tests/benchmark/testLeftOuterJoinSimplificationToInner.json deleted file mode 100644 index 5303e35..0000000 --- a/tests/benchmark/testLeftOuterJoinSimplificationToInner.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($1, 100)])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMaxReuseDistinctAttrWithMixedOptionality.json b/tests/benchmark/testMaxReuseDistinctAttrWithMixedOptionality.json deleted file mode 100644 index e08a9a9..0000000 --- a/tests/benchmark/testMaxReuseDistinctAttrWithMixedOptionality.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MAX","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MAX","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[MAX($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT()], EXPR$2=[MAX($0)])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMergeFilter.json b/tests/benchmark/testMergeFilter.json deleted file mode 100644 index b5b1fb3..0000000 --- a/tests/benchmark/testMergeFilter.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}},{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(NAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMergeIntersect.json b/tests/benchmark/testMergeIntersect.json deleted file mode 100644 index e7bdce7..0000000 --- a/tests/benchmark/testMergeIntersect.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"intersect":[{"intersect":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]},{"intersect":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}],"help":["LogicalIntersect(all=[false])\n LogicalIntersect(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalIntersect(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMergeJoinFilter.json b/tests/benchmark/testMergeJoinFilter.json deleted file mode 100644 index 1b283d3..0000000 --- a/tests/benchmark/testMergeJoinFilter.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}],"help":["LogicalFilter(condition=[=($0, 10)])\n LogicalProject(DEPTNO=[$2], ENAME=[$0])\n LogicalJoin(condition=[AND(=($1, $2), =($2, 10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(DEPTNO=[$2], ENAME=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMergeMinus.json b/tests/benchmark/testMergeMinus.json deleted file mode 100644 index f6a051d..0000000 --- a/tests/benchmark/testMergeMinus.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"except":[{"distinct":{"except":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"except":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalMinus(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMergeUnionAll.json b/tests/benchmark/testMergeUnionAll.json deleted file mode 100644 index d340e3c..0000000 --- a/tests/benchmark/testMergeUnionAll.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"union":[{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]},{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}],"help":["LogicalUnion(all=[true])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMergeUnionDistinct.json b/tests/benchmark/testMergeUnionDistinct.json deleted file mode 100644 index 710d04d..0000000 --- a/tests/benchmark/testMergeUnionDistinct.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"union":[{"distinct":{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalUnion(all=[false])\n LogicalUnion(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalUnion(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMergeUnionMixed2.json b/tests/benchmark/testMergeUnionMixed2.json deleted file mode 100644 index 91a8095..0000000 --- a/tests/benchmark/testMergeUnionMixed2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"union":[{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalUnion(all=[false])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalUnion(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMinReuseDistinctAttrWithMixedOptionality.json b/tests/benchmark/testMinReuseDistinctAttrWithMixedOptionality.json deleted file mode 100644 index 8d191d6..0000000 --- a/tests/benchmark/testMinReuseDistinctAttrWithMixedOptionality.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[MIN($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT()], EXPR$2=[MIN($0)])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMinusMergeRule.json b/tests/benchmark/testMinusMergeRule.json deleted file mode 100644 index 967fee5..0000000 --- a/tests/benchmark/testMinusMergeRule.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"except":[{"except":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"except":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"except":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}]},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}]},{"except":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"except":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}]},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}]}],"help":["LogicalMinus(all=[true])\n LogicalMinus(all=[true])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalMinus(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0], EXPR$2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalMinus(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0], EXPR$2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalMinus(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalMinus(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testMultipleDistinctWithGrouping.json b/tests/benchmark/testMultipleDistinctWithGrouping.json deleted file mode 100644 index a13a400..0000000 --- a/tests/benchmark/testMultipleDistinctWithGrouping.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL","COMM"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"IS NOT DISTINCT FROM","operand":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"IS NOT DISTINCT FROM","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[AVG(DISTINCT $1)], EXPR$3=[SUM(DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(SAL=[$0], EXPR$1=[$1], EXPR$2=[$3], EXPR$3=[$5])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$2=[AVG($1)])\n LogicalAggregate(group=[{0, 1}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$3=[SUM($0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(SAL=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testNoOversimplificationBelowIsNull.json b/tests/benchmark/testNoOversimplificationBelowIsNull.json deleted file mode 100644 index f688511..0000000 --- a/tests/benchmark/testNoOversimplificationBelowIsNull.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NULL","operand":[{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NULL","operand":[{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"NULL","operand":[],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NULL(OR(AND(=($0, 1), =($3, 1)), AND(=($0, null), =($3, 1))))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NULL(OR(AND(=($0, 1), =($3, 1)), AND(null, =($3, 1))))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testOrAlwaysTrue.json b/tests/benchmark/testOrAlwaysTrue.json deleted file mode 100644 index 702d373..0000000 --- a/tests/benchmark/testOrAlwaysTrue.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMPNULLABLES","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,true,true,true,true,true,true,true,true],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testOrAlwaysTrue2.json b/tests/benchmark/testOrAlwaysTrue2.json deleted file mode 100644 index 702d373..0000000 --- a/tests/benchmark/testOrAlwaysTrue2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMPNULLABLES","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,true,true,true,true,true,true,true,true],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testOversimplifiedCaseStatement.json b/tests/benchmark/testOversimplifiedCaseStatement.json deleted file mode 100644 index b3b7a24..0000000 --- a/tests/benchmark/testOversimplifiedCaseStatement.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"operator":"CASE","operand":[{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"/","operand":[{"column":7,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"CASE","operand":[{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"operator":"/","operand":[{"column":7,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"false","operand":[],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(>($3, 0), >(CASE(>($3, 0), /($7, $3), null:INTEGER), 1))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(>($3, 0), CASE(>($3, 0), >(/($7, $3), 1), false))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectAggregateMerge.json b/tests/benchmark/testProjectAggregateMerge.json deleted file mode 100644 index d695cec..0000000 --- a/tests/benchmark/testProjectAggregateMerge.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","SAL","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[+($1, $2)])\n LogicalAggregate(group=[{0, 1}], SS=[SUM($2)])\n LogicalProject(JOB=[$0], DEPTNO=[$2], SAL=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject($f0=[+($1, $2)])\n LogicalAggregate(group=[{0, 1}], SS=[SUM($2)])\n LogicalProject(JOB=[$0], DEPTNO=[$2], SAL=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectAggregateMergeSum0.json b/tests/benchmark/testProjectAggregateMergeSum0.json deleted file mode 100644 index 0856c98..0000000 --- a/tests/benchmark/testProjectAggregateMergeSum0.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":0,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}],"help":["LogicalProject(SS0=[CASE(IS NOT NULL($0), CAST($0):INTEGER NOT NULL, 0)])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], agg#0=[$SUM0($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectAggregateMergeSum0AndSum.json b/tests/benchmark/testProjectAggregateMergeSum0AndSum.json deleted file mode 100644 index fdb0046..0000000 --- a/tests/benchmark/testProjectAggregateMergeSum0AndSum.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"*","operand":[{"column":0,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":0,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"project":{"target":[{"operator":"*","operand":[{"column":0,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[*($0, 2)], SS0=[CASE(IS NOT NULL($0), CAST($0):INTEGER NOT NULL, 0)])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject($f0=[*($0, 2)], $f1=[$1])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)], agg#1=[$SUM0($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectCorrelateTransposeRuleLeftCorrelate.json b/tests/benchmark/testProjectCorrelateTransposeRuleLeftCorrelate.json deleted file mode 100644 index fee8aa8..0000000 --- a/tests/benchmark/testProjectCorrelateTransposeRuleLeftCorrelate.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":9,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":9,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}}]}}]}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":1,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"BOOLEAN"}],"source":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}}]}}]}}}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalProject(EMPNO=[$0], $f0=[$2])\n LogicalCorrelate(correlation=[$cor2], joinType=[left], requiredColumns=[{1}])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor2.DEPTNO, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectJoinRemove1.json b/tests/benchmark/testProjectJoinRemove1.json deleted file mode 100644 index b00f7cf..0000000 --- a/tests/benchmark/testProjectJoinRemove1.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"scan":1}}}}},{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}],"help":["LogicalProject(DEPTNO=[$0], DEPTNO0=[$2])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectJoinRemove10.json b/tests/benchmark/testProjectJoinRemove10.json deleted file mode 100644 index 33f2858..0000000 --- a/tests/benchmark/testProjectJoinRemove10.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO","SLACKER"],"types":["INTEGER","BOOLEAN"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"scan":0}],"help":["LogicalProject(DEPTNO=[$0], SLACKER=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectJoinRemove4.json b/tests/benchmark/testProjectJoinRemove4.json deleted file mode 100644 index 24b218f..0000000 --- a/tests/benchmark/testProjectJoinRemove4.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"scan":0}],"help":["LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectJoinRemove7.json b/tests/benchmark/testProjectJoinRemove7.json deleted file mode 100644 index e0461ea..0000000 --- a/tests/benchmark/testProjectJoinRemove7.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"scan":1}],"help":["LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectJoinTransposeItem.json b/tests/benchmark/testProjectJoinTransposeItem.json deleted file mode 100644 index bf9ea19..0000000 --- a/tests/benchmark/testProjectJoinTransposeItem.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"CUSTOMER","fields":["C_NATIONKEY"],"types":["ANY"],"nullable":[true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"ITEM","operand":[{"column":0,"type":"ANY"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"ANY"},{"operator":"ITEM","operand":[{"column":2,"type":"ANY"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"ANY"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"ANY"},{"column":3,"type":"ANY"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"ANY"},{"operator":"ITEM","operand":[{"column":0,"type":"ANY"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"ANY"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"ANY"},{"operator":"ITEM","operand":[{"column":0,"type":"ANY"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"ANY"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":1,"type":"ANY"},{"column":3,"type":"ANY"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"ANY"},{"column":2,"type":"ANY"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"ANY"},{"operator":"ITEM","operand":[{"column":0,"type":"ANY"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"ANY"}],"source":{"project":{"target":[{"column":0,"type":"ANY"},{"operator":"ITEM","operand":[{"column":0,"type":"ANY"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"ANY"}],"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"ANY"},{"operator":"ITEM","operand":[{"column":0,"type":"ANY"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"ANY"}],"source":{"project":{"target":[{"column":0,"type":"ANY"},{"operator":"ITEM","operand":[{"column":0,"type":"ANY"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"ANY"}],"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(EXPR$0=[ITEM($0, 0)], EXPR$1=[ITEM($2, 0)])\n LogicalJoin(condition=[=($1, $3)], joinType=[left])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$3])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalProject($f1=[$1], EXPR$0=[ITEM($0, 0)])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n LogicalProject($f1=[$1], EXPR$0=[ITEM($0, 0)])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testProjectSetOpTranspose.json b/tests/benchmark/testProjectSetOpTranspose.json deleted file mode 100644 index 0a4c39e..0000000 --- a/tests/benchmark/testProjectSetOpTranspose.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"error":"Not implemented: SUM"}],"source":{"union":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}]}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"error":"Not implemented: SUM"}],"source":{"union":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}]}}}],"help":["LogicalProject(JOB=[$0], EXPR$1=[SUM(+($1, 100)) OVER (PARTITION BY $2)])\n LogicalUnion(all=[true])\n LogicalProject(JOB=[$2], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$2], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(JOB=[$0], EXPR$1=[SUM($2) OVER (PARTITION BY $1)])\n LogicalUnion(all=[true])\n LogicalProject(JOB=[$2], DEPTNO=[$7], EXPR$0=[+($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$2], DEPTNO=[$7], EXPR$0=[+($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullAggregateThroughUnion.json b/tests/benchmark/testPullAggregateThroughUnion.json deleted file mode 100644 index 2da8670..0000000 --- a/tests/benchmark/testPullAggregateThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}]}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}},{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullAggregateThroughUnion2.json b/tests/benchmark/testPullAggregateThroughUnion2.json deleted file mode 100644 index 2da8670..0000000 --- a/tests/benchmark/testPullAggregateThroughUnion2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}]}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}},{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullAggregateThroughUnionAndAddProjects.json b/tests/benchmark/testPullAggregateThroughUnionAndAddProjects.json deleted file mode 100644 index d466313..0000000 --- a/tests/benchmark/testPullAggregateThroughUnionAndAddProjects.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"scan":0},{"scan":0}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullAggregateThroughUnionWithAlias.json b/tests/benchmark/testPullAggregateThroughUnionWithAlias.json deleted file mode 100644 index 0c9fd5d..0000000 --- a/tests/benchmark/testPullAggregateThroughUnionWithAlias.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"scan":0}]}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"scan":0}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantIntoFilter.json b/tests/benchmark/testPullConstantIntoFilter.json deleted file mode 100644 index 7697489..0000000 --- a/tests/benchmark/testPullConstantIntoFilter.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":">","operand":[{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":">","operand":[{"operator":"15","operand":[],"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>(+($7, 5), $0)])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>(15, $0)])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantIntoJoin.json b/tests/benchmark/testPullConstantIntoJoin.json deleted file mode 100644 index b397556..0000000 --- a/tests/benchmark/testPullConstantIntoJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantIntoJoin2.json b/tests/benchmark/testPullConstantIntoJoin2.json deleted file mode 100644 index f4796e2..0000000 --- a/tests/benchmark/testPullConstantIntoJoin2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":10,"type":"INTEGER"},{"column":11,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}},{"project":{"target":[{"operator":"10","operand":[],"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"TIMESTAMP"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"BOOLEAN"},{"operator":"10","operand":[],"type":"INTEGER"},{"column":9,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":8,"type":"INTEGER"},{"operator":"15","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$10], NAME=[$11])\n LogicalJoin(condition=[AND(=($0, $10), =($9, $12))], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[10], ENAME=[$0], JOB=[$1], MGR=[$2], HIREDATE=[$3], SAL=[$4], COMM=[$5], DEPTNO=[$6], SLACKER=[$7], DEPTNO0=[10], NAME=[$9])\n LogicalJoin(condition=[=($8, 15)], joinType=[inner])\n LogicalProject(ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, 10)])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(NAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantIntoProject.json b/tests/benchmark/testPullConstantIntoProject.json deleted file mode 100644 index f9cc2f0..0000000 --- a/tests/benchmark/testPullConstantIntoProject.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(DEPTNO=[$1], EXPR$1=[+($1, 1)], EXPR$2=[+($0, $1)])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[10], EXPR$1=[11], EXPR$2=[+($0, 10)])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantIntoProjectWithIsNotDistinctFrom.json b/tests/benchmark/testPullConstantIntoProjectWithIsNotDistinctFrom.json deleted file mode 100644 index f9cc2f0..0000000 --- a/tests/benchmark/testPullConstantIntoProjectWithIsNotDistinctFrom.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(DEPTNO=[$1], EXPR$1=[+($1, 1)], EXPR$2=[+($0, $1)])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[10], EXPR$1=[11], EXPR$2=[+($0, 10)])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json b/tests/benchmark/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json deleted file mode 100644 index cdf5c3a..0000000 --- a/tests/benchmark/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["MGR","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[true,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"IS NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"project":{"target":[{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalFilter(condition=[IS NULL($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(MGR=[null:INTEGER], DEPTNO=[$1])\n LogicalFilter(condition=[IS NULL($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughAggregateAllConst.json b/tests/benchmark/testPullConstantThroughAggregateAllConst.json deleted file mode 100644 index 12e815d..0000000 --- a/tests/benchmark/testPullConstantThroughAggregateAllConst.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(EXPR$0=[4], EXPR$1=[+(2, 3)], FIVE=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$0], EXPR$1=[+(2, 3)], EXPR$2=[$1])\n LogicalAggregate(group=[{0}], EXPR$2=[MAX($1)])\n LogicalProject(EXPR$0=[4], FIVE=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughAggregateAllLiterals.json b/tests/benchmark/testPullConstantThroughAggregateAllLiterals.json deleted file mode 100644 index b6446e2..0000000 --- a/tests/benchmark/testPullConstantThroughAggregateAllLiterals.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(EXPR$0=[4], EXPR$1=[+(2, 3)], $f2=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$0], EXPR$1=[+(2, 3)], EXPR$2=[$1])\n LogicalAggregate(group=[{0}], EXPR$2=[MAX($1)])\n LogicalProject(EXPR$0=[4], $f2=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughAggregateConstGroupBy.json b/tests/benchmark/testPullConstantThroughAggregateConstGroupBy.json deleted file mode 100644 index aef8557..0000000 --- a/tests/benchmark/testPullConstantThroughAggregateConstGroupBy.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(EXPR$0=[4], EXPR$1=[+(2, 3)], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$0], EXPR$1=[+(2, 3)], EXPR$2=[$1])\n LogicalAggregate(group=[{0}], EXPR$2=[MAX($1)])\n LogicalProject(EXPR$0=[4], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughAggregatePermuted.json b/tests/benchmark/testPullConstantThroughAggregatePermuted.json deleted file mode 100644 index f840faa..0000000 --- a/tests/benchmark/testPullConstantThroughAggregatePermuted.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"operator":"42","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":8,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"+","operand":[{"column":11,"type":"INTEGER"},{"operator":"42","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"operator":"42","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"+","operand":[{"column":9,"type":"INTEGER"},{"operator":"42","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalProject(DEPTNO=[$0], EXPR$1=[$4])\n LogicalAggregate(group=[{0, 1, 2, 3}], EXPR$1=[MAX($4)])\n LogicalProject(DEPTNO=[$7], FOUR=[4], TWO_PLUS_THREE=[+(2, 3)], DEPTNO42=[+($7, 42)], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(DEPTNO=[$7], DEPTNO42=[+($7, 42)], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughAggregatePermutedConstFirst.json b/tests/benchmark/testPullConstantThroughAggregatePermutedConstFirst.json deleted file mode 100644 index 2f69fab..0000000 --- a/tests/benchmark/testPullConstantThroughAggregatePermutedConstFirst.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"4","operand":[],"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}],"help":["LogicalProject(DEPTNO=[$1], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(FOUR=[4], DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughAggregatePermutedConstGroupBy.json b/tests/benchmark/testPullConstantThroughAggregatePermutedConstGroupBy.json deleted file mode 100644 index 0de7202..0000000 --- a/tests/benchmark/testPullConstantThroughAggregatePermutedConstGroupBy.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"+","operand":[{"operator":"42","operand":[],"type":"INTEGER"},{"operator":"24","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"+","operand":[{"operator":"42","operand":[],"type":"INTEGER"},{"operator":"24","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}],"help":["LogicalProject(DEPTNO=[$1], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject($f0=[+(42, 24)], DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughAggregateSimpleNonNullable.json b/tests/benchmark/testPullConstantThroughAggregateSimpleNonNullable.json deleted file mode 100644 index 090087b..0000000 --- a/tests/benchmark/testPullConstantThroughAggregateSimpleNonNullable.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}],"help":["LogicalProject(DEPTNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(DEPTNO=[$7], FOUR=[4], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughConstLast.json b/tests/benchmark/testPullConstantThroughConstLast.json deleted file mode 100644 index e1ea4b9..0000000 --- a/tests/benchmark/testPullConstantThroughConstLast.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}],"help":["LogicalProject(DEPTNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(DEPTNO=[$7], FOUR=[4], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughUnion.json b/tests/benchmark/testPullConstantThroughUnion.json deleted file mode 100644 index 04c3760..0000000 --- a/tests/benchmark/testPullConstantThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"union":[{"project":{"target":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}]},{"project":{"target":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}},{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}]}}}],"help":["LogicalUnion(all=[true])\n LogicalProject(EXPR$0=[2], DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[2], DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[2], DEPTNO=[$0], JOB=[$1])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullConstantThroughUnion3.json b/tests/benchmark/testPullConstantThroughUnion3.json deleted file mode 100644 index f001f42..0000000 --- a/tests/benchmark/testPullConstantThroughUnion3.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"union":[{"project":{"target":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]},{"project":{"target":[{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"union":[{"project":{"target":[{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}}],"help":["LogicalUnion(all=[true])\n LogicalProject(EXPR$0=[2], EXPR$1=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[2], EXPR$1=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[2], EXPR$1=[3])\n LogicalUnion(all=[true])\n LogicalProject(EXPR$0=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullFilterThroughAggregate.json b/tests/benchmark/testPullFilterThroughAggregate.json deleted file mode 100644 index b257755..0000000 --- a/tests/benchmark/testPullFilterThroughAggregate.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","SAL","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"5000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":4,"type":"INTEGER"},{"operator":"5000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"5000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}],"help":["LogicalAggregate(group=[{0, 1, 2}])\n LogicalFilter(condition=[>($1, 5000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalFilter(condition=[>($1, 5000)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullFilterThroughAggregateGroupingSets.json b/tests/benchmark/testPullFilterThroughAggregateGroupingSets.json deleted file mode 100644 index e262700..0000000 --- a/tests/benchmark/testPullFilterThroughAggregateGroupingSets.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","SAL","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"5000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":4,"type":"INTEGER"},{"operator":"5000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"5000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":4,"type":"INTEGER"},{"operator":"5000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1, 2}, {0, 1}, {0}, {}]])\n LogicalFilter(condition=[>($1, 5000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1, 2}, {0, 1}, {0}, {}]])\n LogicalFilter(condition=[>($1, 5000)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPullNull.json b/tests/benchmark/testPullNull.json deleted file mode 100644 index 4d29bd7..0000000 --- a/tests/benchmark/testPullNull.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"operator":"10","operand":[],"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 7), =($0, 10), IS NULL($3), =($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[10], ENAME=[$1], JOB=[$2], MGR=[null:INTEGER], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[7], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 7), =($0, 10), IS NULL($3))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAboveFiltersIntoInnerJoinCondition.json b/tests/benchmark/testPushAboveFiltersIntoInnerJoinCondition.json deleted file mode 100644 index f1dea31..0000000 --- a/tests/benchmark/testPushAboveFiltersIntoInnerJoinCondition.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":6,"type":"TIMESTAMP"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":10,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":6,"type":"TIMESTAMP"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":10,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}],"help":["LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalFilter(condition=[>($0, $5)])\n LogicalJoin(condition=[AND(=($0, $9), >($0, $5))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalJoin(condition=[AND(=($0, $9), >($0, $5))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateFunctionsThroughJoin.json b/tests/benchmark/testPushAggregateFunctionsThroughJoin.json deleted file mode 100644 index 788ecf7..0000000 --- a/tests/benchmark/testPushAggregateFunctionsThroughJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","MGR","SAL","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER","INTEGER"],"nullable":[false,true,false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"operator":"+","operand":[{"column":4,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":6,"type":"BIGINT"},{"column":7,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}]}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":3,"type":"INTEGER"},{"column":8,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":3,"type":"INTEGER"},{"column":8,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"operator":"*","operand":[{"column":5,"type":"BIGINT"},{"column":8,"type":"BIGINT"}],"type":"BIGINT"},{"operator":"*","operand":[{"column":6,"type":"BIGINT"},{"column":8,"type":"BIGINT"}],"type":"BIGINT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":7,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}],"help":["LogicalProject(JOB=[$0], MIN_SAL=[$2], MIN_DEPTNO=[$3], SUM_SAL_PLUS=[+($4, 1)], MAX_SAL=[$5], SUM_SAL_2=[$4], COUNT_SAL=[$6], COUNT_MGR=[$7])\n LogicalAggregate(group=[{0, 4}], MIN_SAL=[MIN($2)], MIN_DEPTNO=[MIN($3)], SUM_SAL_2=[SUM($2)], MAX_SAL=[MAX($2)], COUNT_SAL=[COUNT()], COUNT_MGR=[COUNT($1)])\n LogicalJoin(condition=[=($0, $4)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(JOB=[$0], MIN_SAL=[$1], MIN_DEPTNO=[$2], SUM_SAL_PLUS=[+(CAST(*($3, $8)):INTEGER NOT NULL, 1)], MAX_SAL=[$4], SUM_SAL_2=[CAST(*($3, $8)):INTEGER NOT NULL], COUNT_SAL=[*($5, $8)], COUNT_MGR=[*($6, $8)])\n LogicalJoin(condition=[=($0, $7)], joinType=[inner])\n LogicalAggregate(group=[{0}], MIN_SAL=[MIN($2)], MIN_DEPTNO=[MIN($3)], SUM_SAL_2=[SUM($2)], MAX_SAL=[MAX($2)], COUNT_SAL=[COUNT()], COUNT_MGR=[COUNT($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateSumNoGroup.json b/tests/benchmark/testPushAggregateSumNoGroup.json deleted file mode 100644 index f333709..0000000 --- a/tests/benchmark/testPushAggregateSumNoGroup.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"*","operand":[{"column":1,"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":0,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"*","operand":[{"column":1,"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{}], EXPR$0=[$SUM0($0)])\n LogicalProject($f4=[*($1, $3)])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateSumThroughJoin.json b/tests/benchmark/testPushAggregateSumThroughJoin.json deleted file mode 100644 index a1509ca..0000000 --- a/tests/benchmark/testPushAggregateSumThroughJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB","SAL"],"types":["VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}}}}]}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}],"help":["LogicalProject(JOB=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 2}], EXPR$1=[SUM($1)])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(JOB=[$1], SAL=[$2])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(JOB=[$0], EXPR$1=[CAST(*($1, $3)):INTEGER NOT NULL])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(JOB=[$1], SAL=[$2])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateSumThroughJoinAfterAggregateReduce.json b/tests/benchmark/testPushAggregateSumThroughJoinAfterAggregateReduce.json deleted file mode 100644 index ef11035..0000000 --- a/tests/benchmark/testPushAggregateSumThroughJoinAfterAggregateReduce.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB","SAL"],"types":["VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}}}}]}},{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":1,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"operator":"*","operand":[{"column":2,"type":"BIGINT"},{"column":4,"type":"BIGINT"}],"type":"BIGINT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":1,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"operator":"*","operand":[{"column":2,"type":"BIGINT"},{"column":4,"type":"BIGINT"}],"type":"BIGINT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM($1)])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(JOB=[$1], SAL=[$2])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EXPR$0=[CASE(=($1, 0), null:INTEGER, $0)])\n LogicalAggregate(group=[{}], EXPR$0=[$SUM0($0)], agg#1=[$SUM0($1)])\n LogicalProject($f5=[CAST(*($1, $4)):INTEGER NOT NULL], $f6=[*($2, $4)])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$0=[$SUM0($1)], agg#1=[COUNT()])\n LogicalProject(JOB=[$1], SAL=[$2])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateSumWithoutGroupKeyThroughJoin.json b/tests/benchmark/testPushAggregateSumWithoutGroupKeyThroughJoin.json deleted file mode 100644 index ea76333..0000000 --- a/tests/benchmark/testPushAggregateSumWithoutGroupKeyThroughJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB","SAL"],"types":["VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM($1)])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(JOB=[$1], SAL=[$2])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject($f4=[CAST(*($1, $3)):INTEGER])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$0=[SUM($1)])\n LogicalProject(JOB=[$1], SAL=[$2])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoin1.json b/tests/benchmark/testPushAggregateThroughJoin1.json deleted file mode 100644 index 8e4aa79..0000000 --- a/tests/benchmark/testPushAggregateThroughJoin1.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB"],"types":["VARCHAR","VARCHAR"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":3,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}}}}]}},{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoin2.json b/tests/benchmark/testPushAggregateThroughJoin2.json deleted file mode 100644 index e956979..0000000 --- a/tests/benchmark/testPushAggregateThroughJoin2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","DEPTNO"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"VARCHAR"},{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":5,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"VARCHAR"},{"operator":"+","operand":[{"column":4,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0, 2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[inner])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0, 2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[inner])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoin4.json b/tests/benchmark/testPushAggregateThroughJoin4.json deleted file mode 100644 index e0b1acf..0000000 --- a/tests/benchmark/testPushAggregateThroughJoin4.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"scan":1}}}}}],"help":["LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoin5.json b/tests/benchmark/testPushAggregateThroughJoin5.json deleted file mode 100644 index d12cc43..0000000 --- a/tests/benchmark/testPushAggregateThroughJoin5.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}}]}},{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"scan":1}}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoin6.json b/tests/benchmark/testPushAggregateThroughJoin6.json deleted file mode 100644 index c29e582..0000000 --- a/tests/benchmark/testPushAggregateThroughJoin6.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":1,"type":"BIGINT"},{"column":2,"type":"INTEGER"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":1,"type":"BIGINT"},{"column":2,"type":"INTEGER"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM($1)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject($f3=[CAST(*($1, $2)):INTEGER])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoin7.json b/tests/benchmark/testPushAggregateThroughJoin7.json deleted file mode 100644 index 5feca6d..0000000 --- a/tests/benchmark/testPushAggregateThroughJoin7.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"ANY_VALUE","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"ANY_VALUE","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[ANY_VALUE($1)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[ANY_VALUE($1)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoin8.json b/tests/benchmark/testPushAggregateThroughJoin8.json deleted file mode 100644 index 9500fa5..0000000 --- a/tests/benchmark/testPushAggregateThroughJoin8.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"SINGLE_VALUE","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"SINGLE_VALUE","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SINGLE_VALUE($1)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[SINGLE_VALUE($1)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoinDistinct.json b/tests/benchmark/testPushAggregateThroughJoinDistinct.json deleted file mode 100644 index cfc223a..0000000 --- a/tests/benchmark/testPushAggregateThroughJoinDistinct.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","SAL"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}]}},{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}],"help":["LogicalAggregate(group=[{2}], SUM_SAL=[SUM($1)], C=[COUNT()])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$3], SUM_SAL=[$1], C=[$2])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalAggregate(group=[{0}], SUM_SAL=[SUM($1)], C=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoinOnEmptyLogicalValues.json b/tests/benchmark/testPushAggregateThroughJoinOnEmptyLogicalValues.json deleted file mode 100644 index c0d1d30..0000000 --- a/tests/benchmark/testPushAggregateThroughJoinOnEmptyLogicalValues.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}}},"right":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}}},"right":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"column":3,"type":"BIGINT"},{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":0,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"BIGINT"},{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}}}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], VOLUME=[COUNT()], C1_SUM_SAL=[SUM($0)])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalProject(SAL=[$5], ENAME=[$1])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], VOLUME=[$SUM0($0)], C1_SUM_SAL=[SUM($1)])\n LogicalProject(VOLUME=[$3], $f4=[CAST(*($1, $3)):INTEGER])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$0])\n LogicalProject(SAL=[$5], ENAME=[$1])\n LogicalValues(tuples=[[]])\n LogicalAggregate(group=[{0}], VOLUME=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughJoinWithUniqueInput.json b/tests/benchmark/testPushAggregateThroughJoinWithUniqueInput.json deleted file mode 100644 index 313f924..0000000 --- a/tests/benchmark/testPushAggregateThroughJoinWithUniqueInput.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","MGR","HIREDATE","SAL","COMM","DEPTNO"],"types":["VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER"],"nullable":[false,true,false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":3,"type":"TIMESTAMP"},{"column":4,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"TIMESTAMP"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":3,"type":"TIMESTAMP"}],"distinct":false,"ignoreNulls":false,"type":"TIMESTAMP"},{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":8,"type":"TIMESTAMP"}],"distinct":false,"ignoreNulls":false,"type":"TIMESTAMP"},{"operator":"SUM","operand":[{"column":9,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":5,"type":"TIMESTAMP"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":6,"type":"TIMESTAMP"}],"distinct":false,"ignoreNulls":false,"type":"TIMESTAMP"},{"operator":"SUM","operand":[{"column":8,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":7,"type":"TIMESTAMP"},{"column":8,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":3,"type":"TIMESTAMP"},{"column":4,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":6,"type":"TIMESTAMP"},{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":3,"type":"BIGINT"},{"column":7,"type":"INTEGER"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"TIMESTAMP"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":3,"type":"TIMESTAMP"}],"distinct":false,"ignoreNulls":false,"type":"TIMESTAMP"},{"operator":"SUM","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":6,"type":"TIMESTAMP"}],"distinct":false,"ignoreNulls":false,"type":"TIMESTAMP"},{"operator":"SUM","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":9,"type":"TIMESTAMP"},{"operator":"CAST","operand":[{"operator":"*","operand":[{"column":6,"type":"BIGINT"},{"column":10,"type":"INTEGER"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"VARCHAR"},{"column":9,"type":"INTEGER"},{"column":11,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":5,"type":"TIMESTAMP"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":6,"type":"TIMESTAMP"}],"distinct":false,"ignoreNulls":false,"type":"TIMESTAMP"},{"operator":"SUM","operand":[{"column":8,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":7,"type":"TIMESTAMP"},{"column":8,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}}}]}}}}],"help":["LogicalProject(JOB=[$0], MGR0=[$2], DEPTNO=[$1], HIREDATE1=[$3], COMM1=[$4])\n LogicalAggregate(group=[{0, 2, 3}], HIREDATE1=[MAX($5)], COMM1=[SUM($6)])\n LogicalJoin(condition=[=($1, $4)], joinType=[inner])\n LogicalProject(JOB=[$0], SAL=[$3], DEPTNO=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 2}], HIREDATE1=[MAX($1)], COMM1=[SUM($3)])\n LogicalProject(MGR=[$1], HIREDATE=[$2], SAL=[$3], COMM=[$4])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(JOB=[$0], MGR0=[$2], DEPTNO=[$1], HIREDATE1=[$3], COMM1=[$4])\n LogicalAggregate(group=[{0, 1, 2}], HIREDATE1=[MAX($3)], COMM1=[SUM($4)])\n LogicalProject(JOB=[$0], DEPTNO=[$2], MGR=[$4], HIREDATE1=[$6], $f8=[CAST(*($3, $7)):INTEGER NOT NULL])\n LogicalJoin(condition=[=($1, $5)], joinType=[inner])\n LogicalAggregate(group=[{0, 1, 2}], agg#0=[COUNT()])\n LogicalProject(JOB=[$0], SAL=[$3], DEPTNO=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 2}], HIREDATE1=[MAX($1)], COMM1=[SUM($3)])\n LogicalProject(MGR=[$1], HIREDATE=[$2], SAL=[$3], COMM=[$4])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin1.json b/tests/benchmark/testPushAggregateThroughOuterJoin1.json deleted file mode 100644 index fac98db..0000000 --- a/tests/benchmark/testPushAggregateThroughOuterJoin1.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB"],"types":["VARCHAR","VARCHAR"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":1}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalAggregate(group=[{0, 1}])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin12.json b/tests/benchmark/testPushAggregateThroughOuterJoin12.json deleted file mode 100644 index 020fc1d..0000000 --- a/tests/benchmark/testPushAggregateThroughOuterJoin12.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB"],"types":["VARCHAR","VARCHAR"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin13.json b/tests/benchmark/testPushAggregateThroughOuterJoin13.json deleted file mode 100644 index c80a300..0000000 --- a/tests/benchmark/testPushAggregateThroughOuterJoin13.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB"],"types":["VARCHAR","VARCHAR"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[full])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[full])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin14.json b/tests/benchmark/testPushAggregateThroughOuterJoin14.json deleted file mode 100644 index ea222e6..0000000 --- a/tests/benchmark/testPushAggregateThroughOuterJoin14.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["MGR"],"types":["INTEGER"],"nullable":[true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[full])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin15.json b/tests/benchmark/testPushAggregateThroughOuterJoin15.json deleted file mode 100644 index 28e78fd..0000000 --- a/tests/benchmark/testPushAggregateThroughOuterJoin15.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB","MGR"],"types":["VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":4,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0, 3}])\n LogicalJoin(condition=[=($1, $2)], joinType=[full])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalProject(ENAME=[$0], JOB=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$1], MGR=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 3}])\n LogicalJoin(condition=[=($1, $2)], joinType=[full])\n LogicalAggregate(group=[{0, 1}])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalProject(ENAME=[$0], JOB=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$1], MGR=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin16.json b/tests/benchmark/testPushAggregateThroughOuterJoin16.json deleted file mode 100644 index 868e3f3..0000000 --- a/tests/benchmark/testPushAggregateThroughOuterJoin16.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","DEPTNO"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"FULL","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":4,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"FULL","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"FULL","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":4,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"VARCHAR"},{"operator":"+","operand":[{"column":6,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":4,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[full])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[full])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin2.json b/tests/benchmark/testPushAggregateThroughOuterJoin2.json deleted file mode 100644 index 0bda5c9..0000000 --- a/tests/benchmark/testPushAggregateThroughOuterJoin2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB"],"types":["VARCHAR","VARCHAR"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{1}])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{1}])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin3.json b/tests/benchmark/testPushAggregateThroughOuterJoin3.json deleted file mode 100644 index 698653d..0000000 --- a/tests/benchmark/testPushAggregateThroughOuterJoin3.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB","MGR"],"types":["VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":4,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0, 3}])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalProject(ENAME=[$0], JOB=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$1], MGR=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 3}])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalAggregate(group=[{0, 1}])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalProject(ENAME=[$0], JOB=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$1], MGR=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin4.json b/tests/benchmark/testPushAggregateThroughOuterJoin4.json deleted file mode 100644 index 4564fd4..0000000 --- a/tests/benchmark/testPushAggregateThroughOuterJoin4.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB"],"types":["VARCHAR","VARCHAR"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}}}}]}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}],"help":["LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(JOB=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin5.json b/tests/benchmark/testPushAggregateThroughOuterJoin5.json deleted file mode 100644 index 50f6d63..0000000 --- a/tests/benchmark/testPushAggregateThroughOuterJoin5.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB"],"types":["VARCHAR","VARCHAR"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin6.json b/tests/benchmark/testPushAggregateThroughOuterJoin6.json deleted file mode 100644 index b9a6012..0000000 --- a/tests/benchmark/testPushAggregateThroughOuterJoin6.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","JOB"],"types":["VARCHAR","VARCHAR"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":3,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"scan":1}}}}}}}]}},{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}],"help":["LogicalAggregate(group=[{0, 1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$1])\n LogicalFilter(condition=[=($0, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin7.json b/tests/benchmark/testPushAggregateThroughOuterJoin7.json deleted file mode 100644 index d0c1721..0000000 --- a/tests/benchmark/testPushAggregateThroughOuterJoin7.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","DEPTNO"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":4,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":4,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"VARCHAR"},{"operator":"+","operand":[{"column":6,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":4,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin8.json b/tests/benchmark/testPushAggregateThroughOuterJoin8.json deleted file mode 100644 index 051fd6f..0000000 --- a/tests/benchmark/testPushAggregateThroughOuterJoin8.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","DEPTNO"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":4,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":4,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"VARCHAR"},{"operator":"+","operand":[{"column":6,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":4,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAggregateThroughOuterJoin9.json b/tests/benchmark/testPushAggregateThroughOuterJoin9.json deleted file mode 100644 index 833864c..0000000 --- a/tests/benchmark/testPushAggregateThroughOuterJoin9.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","DEPTNO"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER"],"nullable":[false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"+","operand":[{"column":3,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":4,"type":"VARCHAR"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"VARCHAR"},{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":5,"type":"VARCHAR"},{"operator":"_ISO-8859-1'A'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"VARCHAR"},{"operator":"+","operand":[{"column":4,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}}}}]}}],"help":["LogicalAggregate(group=[{0, 2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0, 2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], $f9=[+($3, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAvgGroupingSetsThroughUnion.json b/tests/benchmark/testPushAvgGroupingSetsThroughUnion.json deleted file mode 100644 index acc7a59..0000000 --- a/tests/benchmark/testPushAvgGroupingSetsThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","JOB","DEPTNO"],"types":["INTEGER","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}]}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[AVG($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[AVG($2)])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushAvgThroughUnion.json b/tests/benchmark/testPushAvgThroughUnion.json deleted file mode 100644 index ef8991c..0000000 --- a/tests/benchmark/testPushAvgThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}]}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[AVG($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[AVG($1)])\n LogicalUnion(all=[true])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushBoolAndBoolOrThroughUnion.json b/tests/benchmark/testPushBoolAndBoolOrThroughUnion.json deleted file mode 100644 index 1bd2781..0000000 --- a/tests/benchmark/testPushBoolAndBoolOrThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":0,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":0,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}]}}},{"aggregate":{"function":[{"operator":"BOOL_AND","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"},{"operator":"BOOL_OR","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":1,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}},{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":1,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":0,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"BOOL_AND","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"},{"operator":"BOOL_OR","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":1,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":0,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"BOOL_AND","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"},{"operator":"BOOL_OR","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":1,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"BOOL_AND","operand":[{"column":2,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"},{"operator":"BOOL_OR","operand":[{"column":3,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":1,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"BOOL_AND","operand":[{"column":3,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"},{"operator":"BOOL_OR","operand":[{"column":3,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":2,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":1,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"BOOL_AND","operand":[{"column":3,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"},{"operator":"BOOL_OR","operand":[{"column":3,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"=","operand":[{"operator":"MOD","operand":[{"column":2,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($1)])\n LogicalUnion(all=[true])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($1)])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($1)])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushCountFilterThroughUnion.json b/tests/benchmark/testPushCountFilterThroughUnion.json deleted file mode 100644 index 180bdce..0000000 --- a/tests/benchmark/testPushCountFilterThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"union":[{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}]}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"union":[{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'CLERK'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT() FILTER $1])\n LogicalProject(DEPTNO=[$1], $f1=[=($0, 'CLERK')])\n LogicalUnion(all=[true])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($1, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT() FILTER $1])\n LogicalProject(DEPTNO=[$1], $f1=[=($0, 'CLERK')])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT() FILTER $1])\n LogicalProject(DEPTNO=[$1], $f1=[=($0, 'CLERK')])\n LogicalFilter(condition=[>($1, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushCountNullableGroupingSetsThroughUnion.json b/tests/benchmark/testPushCountNullableGroupingSetsThroughUnion.json deleted file mode 100644 index 8a42894..0000000 --- a/tests/benchmark/testPushCountNullableGroupingSetsThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","MGR","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,true,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":4,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[$SUM0($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushCountNullableThroughUnion.json b/tests/benchmark/testPushCountNullableThroughUnion.json deleted file mode 100644 index 65ab9a5..0000000 --- a/tests/benchmark/testPushCountNullableThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","MGR"],"types":["VARCHAR","INTEGER"],"nullable":[false,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"scan":0},{"scan":0}]}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"scan":0},{"scan":0}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushCountStarGroupingSetsThroughUnion.json b/tests/benchmark/testPushCountStarGroupingSetsThroughUnion.json deleted file mode 100644 index 5c0e462..0000000 --- a/tests/benchmark/testPushCountStarGroupingSetsThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":4,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT()])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[$SUM0($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(DEPTNO=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushCountStarThroughUnion.json b/tests/benchmark/testPushCountStarThroughUnion.json deleted file mode 100644 index 8f4b81e..0000000 --- a/tests/benchmark/testPushCountStarThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"scan":0},{"scan":0}]}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"scan":0},{"scan":0}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushFilterPastAgg.json b/tests/benchmark/testPushFilterPastAgg.json deleted file mode 100644 index 1a1f21d..0000000 --- a/tests/benchmark/testPushFilterPastAgg.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}],"help":["LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalAggregate(group=[{0}], C=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0}], C=[COUNT()])\n LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushFilterPastAggFour.json b/tests/benchmark/testPushFilterPastAggFour.json deleted file mode 100644 index 26fd3bb..0000000 --- a/tests/benchmark/testPushFilterPastAggFour.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"12","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":3,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"12","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"12","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"12","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":3,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"12","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":3,"type":"INTEGER"},{"operator":"12","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}}}}}]}}],"help":["LogicalAggregate(group=[{1}], EXPR$1=[$SUM0($2)])\n LogicalFilter(condition=[>($0, 12)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{1}], EXPR$1=[$SUM0($2)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT()])\n LogicalFilter(condition=[>($0, 12)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushFilterPastAggTwo.json b/tests/benchmark/testPushFilterPastAggTwo.json deleted file mode 100644 index 8bc25ab..0000000 --- a/tests/benchmark/testPushFilterPastAggTwo.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":">","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'c'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"operator":"OR","operand":[{"operator":">","operand":[{"column":1,"type":"BIGINT"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'z'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'b'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'b'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":">","operand":[{"column":1,"type":"BIGINT"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'z'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'c'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'b'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'c'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'b'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}}],"help":["LogicalProject(C1=[$0])\n LogicalFilter(condition=[AND(>($0, 'c'), OR(>($1, 30), <($0, 'z')))])\n LogicalAggregate(group=[{0}], C2=[COUNT()])\n LogicalFilter(condition=[>($0, 'b')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(C1=[$0])\n LogicalFilter(condition=[OR(>($1, 30), <($0, 'z'))])\n LogicalAggregate(group=[{0}], C2=[COUNT()])\n LogicalFilter(condition=[>($0, 'c')])\n LogicalFilter(condition=[>($0, 'b')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushFilterPastAggWithGroupingSets2.json b/tests/benchmark/testPushFilterPastAggWithGroupingSets2.json deleted file mode 100644 index 502306f..0000000 --- a/tests/benchmark/testPushFilterPastAggWithGroupingSets2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}]}}}}],"help":["LogicalProject(DNAME=[$0], DDEPTNO=[$1], C=[$2])\n LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]], C=[COUNT()])\n LogicalProject(DNAME=[$1], DDEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(DNAME=[$0], DDEPTNO=[$1], C=[$2])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]], C=[COUNT()])\n LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalProject(DNAME=[$1], DDEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushFilterPastProject.json b/tests/benchmark/testPushFilterPastProject.json deleted file mode 100644 index 94df990..0000000 --- a/tests/benchmark/testPushFilterPastProject.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"column":1,"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"join":{"kind":"LEFT","condition":{"column":2,"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}],"help":["LogicalProject(NAME=[$0])\n LogicalJoin(condition=[$1], joinType=[right])\n LogicalProject(NAME=[$0], $f4=[>($1, 10)])\n LogicalJoin(condition=[$2], joinType=[left])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], $f2=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0])\n LogicalJoin(condition=[true], joinType=[right])\n LogicalProject(NAME=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($0, 10)])\n LogicalFilter(condition=[>($0, 10)])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushFilterSemijoin.json b/tests/benchmark/testPushFilterSemijoin.json deleted file mode 100644 index 80f9cea..0000000 --- a/tests/benchmark/testPushFilterSemijoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","DNAME"],"types":["TINYINT","VARCHAR"],"nullable":[false,true],"key":[[0],[1]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","SAL","DEPTNO"],"types":["SMALLINT","DECIMAL","TINYINT"],"nullable":[false,true,true],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":4,"type":"TINYINT"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"DECIMAL"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":4,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"DECIMAL"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}],"help":["LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[AND(=($0, $4), =($3, 100))], joinType=[semi])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, EMP]])\n","LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $4)], joinType=[semi])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalFilter(condition=[=($1, 100)])\n LogicalTableScan(table=[[scott, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushFilterThroughSemiJoin.json b/tests/benchmark/testPushFilterThroughSemiJoin.json deleted file mode 100644 index 2fbd43c..0000000 --- a/tests/benchmark/testPushFilterThroughSemiJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"<=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"<=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":1}}}],"help":["LogicalFilter(condition=[<=($0, 10)])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalFilter(condition=[<=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushFilterWithIsNotDistinctFromPastJoin.json b/tests/benchmark/testPushFilterWithIsNotDistinctFromPastJoin.json deleted file mode 100644 index 8a3fc63..0000000 --- a/tests/benchmark/testPushFilterWithIsNotDistinctFromPastJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":10,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":10,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT DISTINCT FROM","operand":[{"column":1,"type":"VARCHAR"},{"column":10,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalFilter(condition=[OR(AND(IS NULL($1), IS NULL($10)), IS TRUE(=($1, $10)))])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[AND(=($7, $16), IS NOT DISTINCT FROM($1, $10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushJoinCondDownToProject.json b/tests/benchmark/testPushJoinCondDownToProject.json deleted file mode 100644 index ea7a3df..0000000 --- a/tests/benchmark/testPushJoinCondDownToProject.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"=","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":7,"type":"INTEGER"}],"source":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"*","operand":[{"column":7,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}],"help":["LogicalFilter(condition=[=(+($0, 10), *($1, 2))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], DEPTNO0=[$2])\n LogicalJoin(condition=[=($1, $3)], joinType=[inner])\n LogicalProject(DEPTNO=[$0], $f2=[+($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7], $f9=[*($7, 2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushJoinThroughUnionOnLeft.json b/tests/benchmark/testPushJoinThroughUnionOnLeft.json deleted file mode 100644 index d29b339..0000000 --- a/tests/benchmark/testPushJoinThroughUnionOnLeft.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"union":[{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}]},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}],"help":["LogicalProject(SAL=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalUnion(all=[true])\n LogicalProject(SAL=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(SAL=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushJoinThroughUnionOnRight.json b/tests/benchmark/testPushJoinThroughUnionOnRight.json deleted file mode 100644 index e6015bf..0000000 --- a/tests/benchmark/testPushJoinThroughUnionOnRight.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"union":[{"project":{"target":[{"column":8,"type":"BOOLEAN"}],"source":{"scan":0}}},{"project":{"target":[{"column":8,"type":"BOOLEAN"}],"source":{"scan":0}}}]}}}}},{"union":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"operator":"0","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}],"help":["LogicalProject(SAL=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalUnion(all=[true])\n LogicalProject(SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalUnion(all=[true])\n LogicalProject(SAL=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(SAL=[$0])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DUMMY=[0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushMaxNullableGroupingSetsThroughUnion.json b/tests/benchmark/testPushMaxNullableGroupingSetsThroughUnion.json deleted file mode 100644 index 954b44a..0000000 --- a/tests/benchmark/testPushMaxNullableGroupingSetsThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","MGR","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,true,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MAX($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MAX($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushMaxNullableThroughUnion.json b/tests/benchmark/testPushMaxNullableThroughUnion.json deleted file mode 100644 index 003381a..0000000 --- a/tests/benchmark/testPushMaxNullableThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","MGR"],"types":["VARCHAR","INTEGER"],"nullable":[false,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"scan":0},{"scan":0}]}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"scan":0},{"scan":0}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushMinGroupingSetsThroughUnion.json b/tests/benchmark/testPushMinGroupingSetsThroughUnion.json deleted file mode 100644 index d4548e9..0000000 --- a/tests/benchmark/testPushMinGroupingSetsThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","JOB","DEPTNO"],"types":["INTEGER","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MIN($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MIN($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MIN($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MIN($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushMinThroughUnion.json b/tests/benchmark/testPushMinThroughUnion.json deleted file mode 100644 index 49fffb4..0000000 --- a/tests/benchmark/testPushMinThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastFilter.json b/tests/benchmark/testPushProjectPastFilter.json deleted file mode 100644 index c2aef1e..0000000 --- a/tests/benchmark/testPushProjectPastFilter.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","SAL","COMM","DEPTNO"],"types":["INTEGER","VARCHAR","INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"*","operand":[{"operator":"10","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"operator":"UPPER","operand":[{"column":1,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"_ISO-8859-1'FOO'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"*","operand":[{"operator":"10","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"operator":"UPPER","operand":[{"column":1,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"_ISO-8859-1'FOO'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EXPR$0=[+($0, $4)])\n LogicalFilter(condition=[AND(=($2, *(10, $3)), =(UPPER($1), 'FOO'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[+($0, $4)])\n LogicalFilter(condition=[AND(=($2, *(10, $3)), =(UPPER($1), 'FOO'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastFilter2.json b/tests/benchmark/testPushProjectPastFilter2.json deleted file mode 100644 index e77ed86..0000000 --- a/tests/benchmark/testPushProjectPastFilter2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["MGR"],"types":["INTEGER"],"nullable":[true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalFilter(condition=[<($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalFilter(condition=[<($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastFilter3b.json b/tests/benchmark/testPushProjectPastFilter3b.json deleted file mode 100644 index ba8127c..0000000 --- a/tests/benchmark/testPushProjectPastFilter3b.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"operator":"*","operand":[{"operator":"10","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"operator":"UPPER","operand":[{"column":1,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"_ISO-8859-1'FOO'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"TIMESTAMP"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"column":7,"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"operator":"*","operand":[{"operator":"10","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"operator":"UPPER","operand":[{"column":1,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"_ISO-8859-1'FOO'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}],"help":["LogicalProject(X=[+($0, $7)], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(X=[$8], ENAME=[$0], JOB=[$1], MGR=[$2], HIREDATE=[$3], SAL=[$4], COMM=[$5], SLACKER=[$6])\n LogicalFilter(condition=[$7])\n LogicalProject(ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], $f7=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))], $f8=[+($0, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastFilter3c.json b/tests/benchmark/testPushProjectPastFilter3c.json deleted file mode 100644 index 601c3f6..0000000 --- a/tests/benchmark/testPushProjectPastFilter3c.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"operator":"*","operand":[{"operator":"10","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"operator":"UPPER","operand":[{"column":1,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"_ISO-8859-1'FOO'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"TIMESTAMP"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"operator":"*","operand":[{"operator":"10","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"operator":"UPPER","operand":[{"column":0,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"_ISO-8859-1'FOO'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}],"help":["LogicalProject(X=[+($0, $7)], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(X=[$7], ENAME=[$0], JOB=[$1], MGR=[$2], HIREDATE=[$3], SAL=[$4], COMM=[$5], SLACKER=[$6])\n LogicalFilter(condition=[AND(=($4, *(10, $5)), =(UPPER($0), 'FOO'))])\n LogicalProject(ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], $f7=[+($0, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastFullJoin.json b/tests/benchmark/testPushProjectPastFullJoin.json deleted file mode 100644 index 092042f..0000000 --- a/tests/benchmark/testPushProjectPastFullJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"column":1,"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"column":2,"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($1, 11), 11, *(-1, $1))])\n LogicalJoin(condition=[=($0, $2)], joinType=[full])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE($1, 11, $2)])\n LogicalJoin(condition=[=($0, $3)], joinType=[full])\n LogicalProject(ENAME=[$1], EXPR$0=[<($5, 11)], EXPR$1=[*(-1, $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastFullJoinStrong.json b/tests/benchmark/testPushProjectPastFullJoinStrong.json deleted file mode 100644 index 0228fa8..0000000 --- a/tests/benchmark/testPushProjectPastFullJoinStrong.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($1, 11), *(-1, $1), $1)])\n LogicalJoin(condition=[=($0, $2)], joinType=[full])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[full])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastInnerJoin.json b/tests/benchmark/testPushProjectPastInnerJoin.json deleted file mode 100644 index e6b9b1a..0000000 --- a/tests/benchmark/testPushProjectPastInnerJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($1, 11), 11, *(-1, $1))])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastInnerJoinStrong.json b/tests/benchmark/testPushProjectPastInnerJoinStrong.json deleted file mode 100644 index 13ab49c..0000000 --- a/tests/benchmark/testPushProjectPastInnerJoinStrong.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($1, 11), *(-1, $1), $1)])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastJoin.json b/tests/benchmark/testPushProjectPastJoin.json deleted file mode 100644 index 4b73d5b..0000000 --- a/tests/benchmark/testPushProjectPastJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME","COMM"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}},{"project":{"target":[{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalProject(EXPR$0=[+($1, $4)])\n LogicalJoin(condition=[AND(=($0, $3), =($2, 10))], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[+($1, $4)])\n LogicalJoin(condition=[AND(=($0, $3), $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastLeftJoin.json b/tests/benchmark/testPushProjectPastLeftJoin.json deleted file mode 100644 index 3b9f8ea..0000000 --- a/tests/benchmark/testPushProjectPastLeftJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($1, 11), 11, *(-1, $1))])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastLeftJoinSwap.json b/tests/benchmark/testPushProjectPastLeftJoinSwap.json deleted file mode 100644 index 49ea480..0000000 --- a/tests/benchmark/testPushProjectPastLeftJoinSwap.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":3,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"column":2,"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"column":3,"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($2, 11), 11, *(-1, $2))])\n LogicalJoin(condition=[=($1, $0)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE($2, 11, $3)])\n LogicalJoin(condition=[=($1, $0)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$0=[<($5, 11)], EXPR$1=[*(-1, $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastLeftJoinSwapStrong.json b/tests/benchmark/testPushProjectPastLeftJoinSwapStrong.json deleted file mode 100644 index f3c83a3..0000000 --- a/tests/benchmark/testPushProjectPastLeftJoinSwapStrong.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":3,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($2, 11), *(-1, $2), $2)])\n LogicalJoin(condition=[=($1, $0)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$2])\n LogicalJoin(condition=[=($1, $0)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastRightJoin.json b/tests/benchmark/testPushProjectPastRightJoin.json deleted file mode 100644 index 3cd0a1c..0000000 --- a/tests/benchmark/testPushProjectPastRightJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"column":1,"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"column":2,"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($1, 11), 11, *(-1, $1))])\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE($1, 11, $2)])\n LogicalJoin(condition=[=($0, $3)], joinType=[right])\n LogicalProject(ENAME=[$1], EXPR$0=[<($5, 11)], EXPR$1=[*(-1, $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastRightJoinStrong.json b/tests/benchmark/testPushProjectPastRightJoinStrong.json deleted file mode 100644 index 29581a8..0000000 --- a/tests/benchmark/testPushProjectPastRightJoinStrong.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":1,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($1, 11), *(-1, $1), $1)])\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastRightJoinSwap.json b/tests/benchmark/testPushProjectPastRightJoinSwap.json deleted file mode 100644 index 6ec9d9a..0000000 --- a/tests/benchmark/testPushProjectPastRightJoinSwap.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":3,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($2, 11), 11, *(-1, $2))])\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$2])\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastRightJoinSwapStrong.json b/tests/benchmark/testPushProjectPastRightJoinSwapStrong.json deleted file mode 100644 index 11accdd..0000000 --- a/tests/benchmark/testPushProjectPastRightJoinSwapStrong.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"BONUS","fields":["ENAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":2,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":3,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}}},{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":5,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"CASE","operand":[{"operator":"<","operand":[{"column":6,"type":"INTEGER"},{"operator":"11","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"*","operand":[{"operator":"-1","operand":[],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}]}}}}],"help":["LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($2, 11), *(-1, $2), $2)])\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$2])\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectPastSetOp.json b/tests/benchmark/testPushProjectPastSetOp.json deleted file mode 100644 index b079b25..0000000 --- a/tests/benchmark/testPushProjectPastSetOp.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"union":[{"scan":0},{"scan":0}]},{"union":[{"scan":0},{"scan":0}]}],"help":["LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectWithIsNotDistinctFromPastJoin.json b/tests/benchmark/testPushProjectWithIsNotDistinctFromPastJoin.json deleted file mode 100644 index 16e22b8..0000000 --- a/tests/benchmark/testPushProjectWithIsNotDistinctFromPastJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME","JOB","SAL","COMM"],"types":["VARCHAR","VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"IS NOT DISTINCT FROM","operand":[{"column":2,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"operator":"||","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"||","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"VARCHAR"}],"source":{"scan":1}}}}}}},{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"IS NOT DISTINCT FROM","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":5,"type":"INTEGER"},{"operator":"||","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":3,"type":"INTEGER"},{"operator":"||","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"VARCHAR"}],"source":{"scan":1}}}}}}}],"help":["LogicalProject(EXPR$0=[+($0, $3)])\n LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($2, $4), =($1, 10))], joinType=[inner])\n LogicalProject(SAL=[$5], DEPTNO=[$7], $f9=[||($1, $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(COMM=[$3], $f4=[||($0, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[+($0, $3)])\n LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($1, $4), $2)], joinType=[inner])\n LogicalProject(SAL=[$5], $f9=[||($1, $2)], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(COMM=[$3], $f4=[||($0, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectWithOverPastJoin1.json b/tests/benchmark/testPushProjectWithOverPastJoin1.json deleted file mode 100644 index 84b05ba..0000000 --- a/tests/benchmark/testPushProjectWithOverPastJoin1.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME","COMM"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"},{"error":"Not implemented: COUNT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}},{"project":{"target":[{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"},{"error":"Not implemented: COUNT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"},{"column":4,"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalProject(EXPR$0=[+($2, $5)], EXPR$1=[COUNT($0) OVER (PARTITION BY $3)])\n LogicalJoin(condition=[AND(=($1, $4), =($3, 10))], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[+($2, $6)], EXPR$1=[COUNT($0) OVER (PARTITION BY $3)])\n LogicalJoin(condition=[AND(=($1, $5), $4)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], SAL=[$5], DEPTNO=[$7], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectWithOverPastJoin2.json b/tests/benchmark/testPushProjectWithOverPastJoin2.json deleted file mode 100644 index 8a3cb82..0000000 --- a/tests/benchmark/testPushProjectWithOverPastJoin2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME","JOB","SAL","COMM"],"types":["VARCHAR","VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"},{"error":"Not implemented: COUNT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}},{"project":{"target":[{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"},{"error":"Not implemented: COUNT"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalProject(EXPR$0=[+($1, $6)], EXPR$1=[COUNT($5) OVER (PARTITION BY $4)])\n LogicalJoin(condition=[AND(=($0, $3), =($2, 10))], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[+($1, $6)], EXPR$1=[COUNT($5) OVER (PARTITION BY $4)])\n LogicalJoin(condition=[AND(=($0, $3), $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushProjectWithOverPastJoin3.json b/tests/benchmark/testPushProjectWithOverPastJoin3.json deleted file mode 100644 index b3b702a..0000000 --- a/tests/benchmark/testPushProjectWithOverPastJoin3.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"BONUS","fields":["ENAME","JOB","SAL","COMM"],"types":["VARCHAR","VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"INTEGER"},{"error":"Not implemented: SUM"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}},{"project":{"target":[{"operator":"+","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"INTEGER"},{"error":"Not implemented: SUM"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"column":2,"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"+","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}],"help":["LogicalProject(EXPR$0=[+($1, $6)], EXPR$1=[SUM(+(+($5, $5), 100)) OVER (PARTITION BY $4)])\n LogicalJoin(condition=[AND(=($0, $3), =($2, 10))], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n","LogicalProject(EXPR$0=[+($1, $5)], EXPR$1=[SUM($6) OVER (PARTITION BY $4)])\n LogicalJoin(condition=[AND(=($0, $3), $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0], JOB=[$1], COMM=[$3], EXPR$0=[+(+($2, $2), 100)])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSemiJoinConditions.json b/tests/benchmark/testPushSemiJoinConditions.json deleted file mode 100644 index 913c47e..0000000 --- a/tests/benchmark/testPushSemiJoinConditions.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","DEPTNO"],"types":["SMALLINT","VARCHAR","TINYINT"],"nullable":[false,true,true],"key":[[0],[1]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","DNAME"],"types":["TINYINT","VARCHAR"],"nullable":[false,true],"key":[[0],[1]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"TINYINT"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"AND","operand":[{"operator":"OR","operand":[{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":2,"type":"TINYINT"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":0,"type":"TINYINT"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":2,"type":"TINYINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"OR","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":2,"type":"TINYINT"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"scan":1}}}}},{"project":{"target":[{"column":2,"type":"TINYINT"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"AND","operand":[{"operator":"IS NOT DISTINCT FROM","operand":[{"column":2,"type":"TINYINT"},{"column":3,"type":"TINYINT"}],"type":"BOOLEAN"},{"operator":"IS NOT DISTINCT FROM","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}],"help":["LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[AND(OR(=($0, $2), AND(IS NULL($0), IS NULL($2))), OR(=($1, $3), AND(IS NULL($1), IS NULL($3))))], joinType=[semi])\n LogicalProject(DEPTNO=[$2], ENAME=[$1])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, DEPT]])\n","LogicalProject(DEPTNO=[$2])\n LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($2, $3), IS NOT DISTINCT FROM($1, $4))], joinType=[semi])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSemiJoinPastFilter.json b/tests/benchmark/testPushSemiJoinPastFilter.json deleted file mode 100644 index 3793943..0000000 --- a/tests/benchmark/testPushSemiJoinPastFilter.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'foo'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'foo'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},"right":{"scan":1}}}}}],"help":["LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[AND(=($1, $2), =($0, 'foo'))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(ENAME=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalFilter(condition=[=($0, 'foo')])\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSemiJoinPastJoinRuleLeft.json b/tests/benchmark/testPushSemiJoinPastJoinRuleLeft.json deleted file mode 100644 index 5ff7da7..0000000 --- a/tests/benchmark/testPushSemiJoinPastJoinRuleLeft.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","DEPTNO"],"types":["INTEGER","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},"right":{"scan":1}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}],"help":["LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($2, $3), =($0, $4))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($0, $4)], joinType=[inner])\n LogicalJoin(condition=[=($2, $3)], joinType=[inner])\n LogicalJoin(condition=[=($0, $3)], joinType=[semi])\n LogicalJoin(condition=[=($2, $3)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSemiJoinPastJoinRuleRight.json b/tests/benchmark/testPushSemiJoinPastJoinRuleRight.json deleted file mode 100644 index 10ccddb..0000000 --- a/tests/benchmark/testPushSemiJoinPastJoinRuleRight.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":1},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}],"help":["LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[AND(=($1, $2), =($2, $3))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(ENAME=[$0])\n LogicalJoin(condition=[=($2, $3)], joinType=[inner])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalJoin(condition=[=($0, $1)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSemiJoinPastProject.json b/tests/benchmark/testPushSemiJoinPastProject.json deleted file mode 100644 index f4cc8ed..0000000 --- a/tests/benchmark/testPushSemiJoinPastProject.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"TRIM","operand":[{"operator":"BOTH","operand":[],"type":"SYMBOL"},{"operator":"_ISO-8859-1' '","operand":[],"type":"CHAR"},{"column":2,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"*","operand":[{"column":5,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":"TRIM","operand":[{"operator":"BOTH","operand":[],"type":"SYMBOL"},{"operator":"_ISO-8859-1' '","operand":[],"type":"CHAR"},{"column":1,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"scan":1}}}}},"right":{"scan":1}}}}}],"help":["LogicalProject(ENAME=[$0], EXPR$1=[$1], EXPR$2=[$2], DEPTNO=[$3])\n LogicalFilter(condition=[=($3, $4)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(ENAME=[$1], EXPR$1=[TRIM(FLAG(BOTH), ' ', $2)], EXPR$2=[*($5, 2)], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(ENAME=[$0], EXPR$1=[$1], EXPR$2=[$2], DEPTNO=[$3])\n LogicalJoin(condition=[=($3, $4)], joinType=[inner])\n LogicalProject(ENAME=[$0], EXPR$1=[TRIM(FLAG(BOTH), ' ', $1)], EXPR$2=[*($2, 2)], DEPTNO=[$3])\n LogicalJoin(condition=[=($3, $4)], joinType=[semi])\n LogicalProject(ENAME=[$1], JOB=[$2], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSumConstantGroupingSetsThroughUnion.json b/tests/benchmark/testPushSumConstantGroupingSetsThroughUnion.json deleted file mode 100644 index 2d1f2cd..0000000 --- a/tests/benchmark/testPushSumConstantGroupingSetsThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"union":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"union":[{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":9,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":9,"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":6,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":6,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$1], JOB=[$0], U=[$2])\n LogicalUnion(all=[true])\n LogicalProject(JOB=[$2], DEPTNO=[$7], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$2], DEPTNO=[$7], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSumConstantThroughUnion.json b/tests/benchmark/testPushSumConstantThroughUnion.json deleted file mode 100644 index b50c00e..0000000 --- a/tests/benchmark/testPushSumConstantThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"2","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"3","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalProject(ENAME=[$1], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$1], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSumCountStarGroupingSetsThroughUnion.json b/tests/benchmark/testPushSumCountStarGroupingSetsThroughUnion.json deleted file mode 100644 index 8570ebc..0000000 --- a/tests/benchmark/testPushSumCountStarGroupingSetsThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","JOB","DEPTNO"],"types":["INTEGER","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":5,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":5,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)], EXPR$3=[COUNT()], EXPR$4=[MIN($0)], EXPR$5=[MAX($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)], EXPR$3=[$SUM0($3)], EXPR$4=[MIN($4)], EXPR$5=[MAX($5)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)], EXPR$3=[COUNT()], EXPR$4=[MIN($0)], EXPR$5=[MAX($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)], EXPR$3=[COUNT()], EXPR$4=[MIN($0)], EXPR$5=[MAX($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSumCountStarThroughUnion.json b/tests/benchmark/testPushSumCountStarThroughUnion.json deleted file mode 100644 index 614f6e6..0000000 --- a/tests/benchmark/testPushSumCountStarThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","DEPTNO"],"types":["INTEGER","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":3,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT()], EXPR$3=[MIN($2)], EXPR$4=[MAX($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], DEPTNO=[$2])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[$SUM0($2)], EXPR$3=[MIN($3)], EXPR$4=[MAX($4)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT()], EXPR$3=[MIN($2)], EXPR$4=[MAX($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], DEPTNO=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT()], EXPR$3=[MIN($2)], EXPR$4=[MAX($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], DEPTNO=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSumNullConstantGroupingSetsThroughUnion.json b/tests/benchmark/testPushSumNullConstantGroupingSetsThroughUnion.json deleted file mode 100644 index 43856d6..0000000 --- a/tests/benchmark/testPushSumNullConstantGroupingSetsThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"union":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"union":[{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":9,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":4,"type":"VARCHAR"},{"column":9,"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":6,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":6,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$1], JOB=[$0], U=[$2])\n LogicalUnion(all=[true])\n LogicalProject(JOB=[$2], DEPTNO=[$7], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$2], DEPTNO=[$7], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSumNullConstantThroughUnion.json b/tests/benchmark/testPushSumNullConstantThroughUnion.json deleted file mode 100644 index 43ab2f7..0000000 --- a/tests/benchmark/testPushSumNullConstantThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalProject(ENAME=[$1], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$1], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSumNullableGroupingSetsThroughUnion.json b/tests/benchmark/testPushSumNullableGroupingSetsThroughUnion.json deleted file mode 100644 index bca61ca..0000000 --- a/tests/benchmark/testPushSumNullableGroupingSetsThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","MGR","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,true,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"union":[{"scan":0},{"scan":0}]}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$2], JOB=[$0], MGR=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSumNullableNOGBYThroughUnion.json b/tests/benchmark/testPushSumNullableNOGBYThroughUnion.json deleted file mode 100644 index 142c961..0000000 --- a/tests/benchmark/testPushSumNullableNOGBYThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["MGR"],"types":["INTEGER"],"nullable":[true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"union":[{"scan":0},{"scan":0}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"union":[{"scan":0},{"scan":0}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testPushSumNullableThroughUnion.json b/tests/benchmark/testPushSumNullableThroughUnion.json deleted file mode 100644 index 7415aff..0000000 --- a/tests/benchmark/testPushSumNullableThroughUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","MGR"],"types":["VARCHAR","INTEGER"],"nullable":[false,true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"scan":0},{"scan":0}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"scan":0},{"scan":0}]}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}]}}}}}]}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceAggregateFunctionsByGroup.json b/tests/benchmark/testReduceAggregateFunctionsByGroup.json deleted file mode 100644 index 8018a09..0000000 --- a/tests/benchmark/testReduceAggregateFunctionsByGroup.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"ANY_VALUE","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"FIRST_VALUE","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"LAST_VALUE","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":0,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}],"help":["LogicalProject(SAL=[$0], SAL_MAX=[$2], SAL_MIN=[$3], SAL_AVG=[$4], SAL_VAL=[$5], SAL_FIRST=[$6], SAL_LAST=[$7])\n LogicalAggregate(group=[{0, 1}], SAL_MAX=[MAX($0)], SAL_MIN=[MIN($0)], SAL_AVG=[AVG($0)], SAL_VAL=[ANY_VALUE($0)], SAL_FIRST=[FIRST_VALUE($0)], SAL_LAST=[LAST_VALUE($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(SAL=[$0], SAL_MAX=[$0], SAL_MIN=[$0], SAL_AVG=[$0], SAL_VAL=[$0], SAL_FIRST=[$0], SAL_LAST=[$0])\n LogicalAggregate(group=[{0, 1}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceAllAggregateFunctions.json b/tests/benchmark/testReduceAllAggregateFunctions.json deleted file mode 100644 index 5bf87c3..0000000 --- a/tests/benchmark/testReduceAllAggregateFunctions.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"STDDEV_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"STDDEV_SAMP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"VAR_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"VAR_SAMP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"operator":"CAST","operand":[{"operator":"POWER","operand":[{"operator":"/","operand":[{"operator":"-","operand":[{"column":1,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"},{"operator":"0.5","operand":[],"type":"DECIMAL"}],"type":"DOUBLE"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"POWER","operand":[{"operator":"/","operand":[{"operator":"-","operand":[{"column":1,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BIGINT"},{"operator":"-","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"operator":"0.5","operand":[],"type":"DECIMAL"}],"type":"DOUBLE"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"-","operand":[{"column":1,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"-","operand":[{"column":1,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"BIGINT"},{"operator":"-","operand":[{"column":3,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[STDDEV_SAMP($1)], EXPR$4=[VAR_POP($1)], EXPR$5=[VAR_SAMP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0], EXPR$1=[CAST(POWER(/(-($1, /(*($2, $2), $3)), $3), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[CAST(POWER(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1))), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$4=[CAST(/(-($1, /(*($2, $2), $3)), $3)):INTEGER NOT NULL], EXPR$5=[CAST(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1)))):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($2)], agg#1=[$SUM0($1)], agg#2=[COUNT()])\n LogicalProject(NAME=[$0], DEPTNO=[$1], $f2=[*($1, $1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceAverage.json b/tests/benchmark/testReduceAverage.json deleted file mode 100644 index 1072027..0000000 --- a/tests/benchmark/testReduceAverage.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":1,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"VARCHAR"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":1,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[MAX($0)], EXPR$2=[AVG($1)], EXPR$3=[MIN($0)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0], EXPR$1=[$0], EXPR$2=[CAST(/($1, $2)):INTEGER NOT NULL], EXPR$3=[$0])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1)], agg#1=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceAverageAndSumWithNoReduceStddevAndVar.json b/tests/benchmark/testReduceAverageAndSumWithNoReduceStddevAndVar.json deleted file mode 100644 index 6371da0..0000000 --- a/tests/benchmark/testReduceAverageAndSumWithNoReduceStddevAndVar.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"STDDEV_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"VAR_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"STDDEV_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"VAR_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[VAR_POP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[$4])\n LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], agg#1=[$SUM0($1)], agg#2=[COUNT()], EXPR$3=[VAR_POP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceAverageAndVarWithNoReduceStddev.json b/tests/benchmark/testReduceAverageAndVarWithNoReduceStddev.json deleted file mode 100644 index d63b8b2..0000000 --- a/tests/benchmark/testReduceAverageAndVarWithNoReduceStddev.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"STDDEV_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"VAR_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"-","operand":[{"column":4,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"operator":"*","operand":[{"column":1,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"STDDEV_POP","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"operator":"*","operand":[{"column":2,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[VAR_POP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[CAST(/(-($4, /(*($2, $2), $3)), $3)):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], agg#1=[SUM($1)], agg#2=[COUNT()], agg#3=[SUM($2)])\n LogicalProject(NAME=[$0], DEPTNO=[$1], $f2=[*($1, $1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceAverageWithNoReduceSum.json b/tests/benchmark/testReduceAverageWithNoReduceSum.json deleted file mode 100644 index 0edce5f..0000000 --- a/tests/benchmark/testReduceAverageWithNoReduceSum.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MAX","operand":[{"column":1,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"VARCHAR"},{"operator":"AVG","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":1,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":0,"type":"VARCHAR"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[MAX($0)], EXPR$2=[AVG($1)], EXPR$3=[MIN($0)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0], EXPR$1=[$0], EXPR$2=[CAST(/($1, $2)):INTEGER NOT NULL], EXPR$3=[$0])\n LogicalAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceCase.json b/tests/benchmark/testReduceCase.json deleted file mode 100644 index 0f4c9c1..0000000 --- a/tests/benchmark/testReduceCase.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"CASE","operand":[{"operator":"false","operand":[],"type":"BOOLEAN"},{"operator":"2.1","operand":[],"type":"FLOAT"},{"operator":"1","operand":[],"type":"FLOAT"}],"type":"FLOAT"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"1","operand":[],"type":"FLOAT"}],"source":{"scan":0}}}],"help":["LogicalProject(NEWCOL=[CASE(false, 2.1:FLOAT, 1:FLOAT)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(NEWCOL=[1E0:FLOAT])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceCaseNullabilityChange.json b/tests/benchmark/testReduceCaseNullabilityChange.json deleted file mode 100644 index 0185980..0000000 --- a/tests/benchmark/testReduceCaseNullabilityChange.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"IS NOT NULL","operand":[{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"CAST","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}],"help":["LogicalProject(QX=[CASE(=($0, 1), 1, IS NOT NULL(1), 2, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(QX=[CAST(CASE(=($0, 1), 1, 2)):INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceCastAndConsts.json b/tests/benchmark/testReduceCastAndConsts.json deleted file mode 100644 index 2a0cf5a..0000000 --- a/tests/benchmark/testReduceCastAndConsts.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CAST","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"/","operand":[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"13","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"13","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=(CAST(+($0, /(10, 2))):INTEGER NOT NULL, 13)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=(+($0, 5), 13)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceCasts.json b/tests/benchmark/testReduceCasts.json deleted file mode 100644 index 9c3494f..0000000 --- a/tests/benchmark/testReduceCasts.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"CAST","operand":[{"column":0,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"CAST","operand":[{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CAST","operand":[{"operator":"CAST","operand":[{"column":2,"type":"VARCHAR"}],"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"_ISO-8859-1'Manager'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"operator":"CAST","operand":[{"column":0,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"operator":"CAST","operand":[{"column":7,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}},{"project":{"target":[{"operator":"CAST","operand":[{"column":0,"type":"VARCHAR"}],"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CAST","operand":[{"operator":"CAST","operand":[{"column":2,"type":"VARCHAR"}],"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"_ISO-8859-1'Manager'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":7,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}}],"help":["LogicalProject(EXPR$0=[CAST($0):VARCHAR(128) NOT NULL], EXPR$1=[CAST($1):INTEGER NOT NULL])\n LogicalFilter(condition=[=(CAST(CAST($2):VARCHAR(1) NOT NULL):VARCHAR(7) NOT NULL, 'Manager')])\n LogicalProject(NAME=[$0], EMPNO=[$2], JOB=[$3])\n LogicalJoin(condition=[=($1, $4)], joinType=[inner])\n LogicalProject(NAME=[$1], DEPTNO0=[CAST($0):INTEGER NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], JOB=[$2], DEPTNO0=[CAST($7):INTEGER NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[CAST($0):VARCHAR(128) NOT NULL], EXPR$1=[$1])\n LogicalFilter(condition=[=(CAST(CAST($2):VARCHAR(1) NOT NULL):VARCHAR(7) NOT NULL, 'Manager')])\n LogicalProject(NAME=[$0], EMPNO=[$2], JOB=[$3])\n LogicalJoin(condition=[=($1, $4)], joinType=[inner])\n LogicalProject(NAME=[$1], DEPTNO0=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], JOB=[$2], DEPTNO0=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceCompositeInSubQuery.json b/tests/benchmark/testReduceCompositeInSubQuery.json deleted file mode 100644 index 7f56997..0000000 --- a/tests/benchmark/testReduceCompositeInSubQuery.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IN","operand":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"query":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"column":11,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":10,"type":"INTEGER"},{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":18,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},"type":"BOOLEAN"},{"operator":"<","operand":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"40","operand":[],"type":"INTEGER"},{"operator":"60","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IN","operand":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"query":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"INTEGER"},{"column":11,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":10,"type":"INTEGER"},{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":18,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},"type":"BOOLEAN"},{"operator":"<","operand":[{"column":7,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($7, +(40, 60)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($7, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstants.json b/tests/benchmark/testReduceConstants.json deleted file mode 100644 index 4f703c7..0000000 --- a/tests/benchmark/testReduceConstants.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"3","operand":[],"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"+","operand":[{"operator":"5","operand":[],"type":"INTEGER"},{"operator":"6","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"ROW","operand":[{"operator":"+","operand":[{"operator":"7","operand":[],"type":"INTEGER"},{"operator":"8","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"ROW"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"7","operand":[],"type":"INTEGER"},{"operator":"8","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"operator":"-","operand":[{"operator":"5","operand":[],"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}}}}},{"project":{"target":[{"operator":"3","operand":[],"type":"INTEGER"},{"operator":"22","operand":[],"type":"INTEGER"},{"operator":"26","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"ROW","operand":[{"operator":"15","operand":[],"type":"INTEGER"}],"type":"ROW"}],"source":{"values":{"schema":["INTEGER","VARCHAR","INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}}}],"help":["LogicalProject(EXPR$0=[+(1, 2)], EXPR$1=[+($0, +(3, 4))], EXPR$2=[+(+(5, 6), $0)], EXPR$3=[null:INTEGER], EXPR$4=[CASE(IS NOT NULL(2), 2, null:INTEGER)], EXPR$5=[ROW(+(7, 8))])\n LogicalFilter(condition=[AND(=($0, +(7, 8)), =($0, CASE(IS NOT NULL(2), 2, null:INTEGER)))])\n LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject($f9=[+($7, -(5, 5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[3], EXPR$1=[22], EXPR$2=[26], EXPR$3=[null:INTEGER], EXPR$4=[CAST(2):INTEGER], EXPR$5=[ROW(15)])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstants3.json b/tests/benchmark/testReduceConstants3.json deleted file mode 100644 index f169671..0000000 --- a/tests/benchmark/testReduceConstants3.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["MGR"],"types":["INTEGER"],"nullable":[true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}}}},{"project":{"target":[{"operator":"IS NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}}}}],"help":["LogicalProject(EXPR$0=[OR(AND(IS NULL($0), IS NULL($1)), IS TRUE(=($0, $1)))])\n LogicalFilter(condition=[IS NULL($0)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[IS NULL($1)])\n LogicalFilter(condition=[IS NULL($0)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsCaseEquals.json b/tests/benchmark/testReduceConstantsCaseEquals.json deleted file mode 100644 index 8a214fd..0000000 --- a/tests/benchmark/testReduceConstantsCaseEquals.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalFilter(condition=[=(CASE(=($0, 20), 2, =($0, 10), 1, 3), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsCaseEquals2.json b/tests/benchmark/testReduceConstantsCaseEquals2.json deleted file mode 100644 index 5144fc8..0000000 --- a/tests/benchmark/testReduceConstantsCaseEquals2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalFilter(condition=[=(CASE(=($0, 20), 2, =($0, 10), 1, null:INTEGER), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsCaseEquals3.json b/tests/benchmark/testReduceConstantsCaseEquals3.json deleted file mode 100644 index 4ea8465..0000000 --- a/tests/benchmark/testReduceConstantsCaseEquals3.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"111","operand":[],"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"2","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"30","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"111","operand":[],"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":0,"type":"INTEGER"},{"operator":"Sarg[10, 30]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":0,"type":"INTEGER"},{"operator":"Sarg[10, 30]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalFilter(condition=[=(CASE(=($0, 30), 1, =($0, 20), 2, =($0, 10), 1, =($0, 30), 111, 0), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalFilter(condition=[SEARCH($0, Sarg[10, 30])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsDup.json b/tests/benchmark/testReduceConstantsDup.json deleted file mode 100644 index 0d09647..0000000 --- a/tests/benchmark/testReduceConstantsDup.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"values":{"schema":["INTEGER"],"content":[]}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","VARCHAR"],"content":[]}}}}],"help":["LogicalValues(tuples=[[]])\n","LogicalProject(DEPTNO=[$0])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsDup2.json b/tests/benchmark/testReduceConstantsDup2.json deleted file mode 100644 index 6aac833..0000000 --- a/tests/benchmark/testReduceConstantsDup2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"operator":"8","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"operator":"10","operand":[],"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 7), =($7, 8), =($0, 10), IS NULL($3), =($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[10], ENAME=[$1], JOB=[$2], MGR=[null:INTEGER], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsDup3.json b/tests/benchmark/testReduceConstantsDup3.json deleted file mode 100644 index 323b6be..0000000 --- a/tests/benchmark/testReduceConstantsDup3.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"scan":0},{"scan":0}],"help":["LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsDup3Null.json b/tests/benchmark/testReduceConstantsDup3Null.json deleted file mode 100644 index ce26dff..0000000 --- a/tests/benchmark/testReduceConstantsDup3Null.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","MGR"],"types":["INTEGER","INTEGER"],"nullable":[false,true],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsDupNot.json b/tests/benchmark/testReduceConstantsDupNot.json deleted file mode 100644 index 323b6be..0000000 --- a/tests/benchmark/testReduceConstantsDupNot.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"scan":0},{"scan":0}],"help":["LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsDupNot2.json b/tests/benchmark/testReduceConstantsDupNot2.json deleted file mode 100644 index 323b6be..0000000 --- a/tests/benchmark/testReduceConstantsDupNot2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"scan":0},{"scan":0}],"help":["LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsDupNot2Null.json b/tests/benchmark/testReduceConstantsDupNot2Null.json deleted file mode 100644 index 90b0074..0000000 --- a/tests/benchmark/testReduceConstantsDupNot2Null.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","MGR","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[false,true,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IS NOT NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":2,"type":"INTEGER"},{"operator":"8","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IS NOT NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":2,"type":"INTEGER"},{"operator":"8","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IS NOT NULL($1), <>($2, 8))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IS NOT NULL($1), <>($2, 8))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsDupNotNull.json b/tests/benchmark/testReduceConstantsDupNotNull.json deleted file mode 100644 index ce26dff..0000000 --- a/tests/benchmark/testReduceConstantsDupNotNull.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","MGR"],"types":["INTEGER","INTEGER"],"nullable":[false,true],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsEliminatesFilter.json b/tests/benchmark/testReduceConstantsEliminatesFilter.json deleted file mode 100644 index 15827a0..0000000 --- a/tests/benchmark/testReduceConstantsEliminatesFilter.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"operator":"+","operand":[{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"3","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}]]}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[]}}}}],"help":["LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalFilter(condition=[>(+(1, 2), +(3, null))])\n LogicalValues(tuples=[[{ 1, 2 }]])\n","LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsIsNotNull.json b/tests/benchmark/testReduceConstantsIsNotNull.json deleted file mode 100644 index 2336f9f..0000000 --- a/tests/benchmark/testReduceConstantsIsNotNull.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}],"help":["LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsIsNull.json b/tests/benchmark/testReduceConstantsIsNull.json deleted file mode 100644 index 6bc0082..0000000 --- a/tests/benchmark/testReduceConstantsIsNull.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"values":{"schema":["INTEGER"],"content":[]}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}}}],"help":["LogicalValues(tuples=[[]])\n","LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsNegated.json b/tests/benchmark/testReduceConstantsNegated.json deleted file mode 100644 index 6bc0082..0000000 --- a/tests/benchmark/testReduceConstantsNegated.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"values":{"schema":["INTEGER"],"content":[]}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}}}],"help":["LogicalValues(tuples=[[]])\n","LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsNegatedInverted.json b/tests/benchmark/testReduceConstantsNegatedInverted.json deleted file mode 100644 index 6bc0082..0000000 --- a/tests/benchmark/testReduceConstantsNegatedInverted.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"values":{"schema":["INTEGER"],"content":[]}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"content":[]}}}}],"help":["LogicalValues(tuples=[[]])\n","LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsNull.json b/tests/benchmark/testReduceConstantsNull.json deleted file mode 100644 index 19ab407..0000000 --- a/tests/benchmark/testReduceConstantsNull.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"IS NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"IS NULL","operand":[{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"operator":"NULL","operand":[],"type":"INTEGER"}],"source":{"scan":0}}}],"help":["LogicalFilter(condition=[IS NULL($0)])\n LogicalFilter(condition=[IS NULL($0)])\n LogicalProject(N=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(N=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsNullEqualsOne.json b/tests/benchmark/testReduceConstantsNullEqualsOne.json deleted file mode 100644 index 42f3e15..0000000 --- a/tests/benchmark/testReduceConstantsNullEqualsOne.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"values":{"schema":["INTEGER"],"content":[]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER"],"content":[]}}}}}}]}},{"distinct":{"correlate":[{"project":{"target":[],"source":{"values":{"schema":["INTEGER"],"content":[]}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER"],"content":[]}}}}}}]}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalValues(tuples=[[]])\n","LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsProjectNullable.json b/tests/benchmark/testReduceConstantsProjectNullable.json deleted file mode 100644 index 4e9c764..0000000 --- a/tests/benchmark/testReduceConstantsProjectNullable.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["MGR"],"types":["INTEGER"],"nullable":[true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"project":{"target":[{"operator":"CAST","operand":[{"operator":"10","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(MGR=[CAST(10):INTEGER])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceConstantsRequiresExecutor.json b/tests/benchmark/testReduceConstantsRequiresExecutor.json deleted file mode 100644 index 15827a0..0000000 --- a/tests/benchmark/testReduceConstantsRequiresExecutor.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"operator":"+","operand":[{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"+","operand":[{"operator":"3","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}]]}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[]}}}}],"help":["LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalFilter(condition=[>(+(1, 2), +(3, null))])\n LogicalValues(tuples=[[{ 1, 2 }]])\n","LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceDynamic.json b/tests/benchmark/testReduceDynamic.json deleted file mode 100644 index 267d76a..0000000 --- a/tests/benchmark/testReduceDynamic.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"USER","operand":[],"type":"VARCHAR"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"_ISO-8859-1'happyCalciteUser'","operand":[],"type":"VARCHAR"}],"source":{"scan":0}}}],"help":["LogicalProject(USER=[USER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(USER=['happyCalciteUser':VARCHAR(2000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceNestedCaseWhen.json b/tests/benchmark/testReduceNestedCaseWhen.json deleted file mode 100644 index f5818b5..0000000 --- a/tests/benchmark/testReduceNestedCaseWhen.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"2000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":0,"type":"INTEGER"},{"operator":"Sarg[1000, 2000]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}],"help":["LogicalFilter(condition=[OR(AND(=($0, 1000), IS NULL(CASE(=($0, 1000), null:INTEGER, 1))), AND(IS NULL(CASE(=($0, 2000), null:INTEGER, 1)), <>($0, 1000)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalFilter(condition=[SEARCH($0, Sarg[1000, 2000])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceNullableToNotNull.json b/tests/benchmark/testReduceNullableToNotNull.json deleted file mode 100644 index 0744c3d..0000000 --- a/tests/benchmark/testReduceNullableToNotNull.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"operator":"_ISO-8859-1'a'","operand":[],"type":"CHAR"},{"operator":"_ISO-8859-1'a'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}],"help":["LogicalProject(NEWCOL=[+($0, CASE(=('a', 'a'), 1, null:INTEGER))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(NEWCOL=[+($0, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceNullableToNotNull2.json b/tests/benchmark/testReduceNullableToNotNull2.json deleted file mode 100644 index 0744c3d..0000000 --- a/tests/benchmark/testReduceNullableToNotNull2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"operator":"_ISO-8859-1'a'","operand":[],"type":"CHAR"},{"operator":"_ISO-8859-1'a'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"NULL","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}],"help":["LogicalProject(NEWCOL=[+($0, CASE(=('a', 'a'), 1, null:INTEGER))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(NEWCOL=[+($0, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceOrCaseWhen.json b/tests/benchmark/testReduceOrCaseWhen.json deleted file mode 100644 index d837933..0000000 --- a/tests/benchmark/testReduceOrCaseWhen.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"filter":{"condition":{"operator":"OR","operand":[{"operator":"IS NULL","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"2000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":0,"type":"INTEGER"},{"operator":"Sarg[1000, 2000]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}],"help":["LogicalFilter(condition=[OR(IS NULL(CASE(=($0, 1000), null:INTEGER, 1)), IS NULL(CASE(=($0, 2000), null:INTEGER, 1)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalFilter(condition=[SEARCH($0, Sarg[1000, 2000])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceValuesToEmpty.json b/tests/benchmark/testReduceValuesToEmpty.json deleted file mode 100644 index f7406f9..0000000 --- a/tests/benchmark/testReduceValuesToEmpty.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"operator":"-","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}]]}}}}}},{"values":{"schema":["INTEGER","INTEGER","INTEGER"],"content":[]}}],"help":["LogicalProject(X=[+($0, $1)], B=[$1], A=[$0])\n LogicalFilter(condition=[<(-($0, $1), 0)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 7 }]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceValuesUnderFilter.json b/tests/benchmark/testReduceValuesUnderFilter.json deleted file mode 100644 index be2e7be..0000000 --- a/tests/benchmark/testReduceValuesUnderFilter.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"CHAR"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"15","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","CHAR"],"content":[[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"_ISO-8859-1'x'","operand":[],"type":"CHAR"}],[{"operator":"20","operand":[],"type":"INTEGER"},{"operator":"_ISO-8859-1'y'","operand":[],"type":"CHAR"}]]}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"CHAR"}],"source":{"values":{"schema":["INTEGER","CHAR"],"content":[[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"_ISO-8859-1'x'","operand":[],"type":"CHAR"}]]}}}}],"help":["LogicalProject(A=[$0], B=[$1])\n LogicalFilter(condition=[<($0, 15)])\n LogicalValues(tuples=[[{ 10, 'x' }, { 20, 'y' }]])\n","LogicalProject(A=[$0], B=[$1])\n LogicalValues(tuples=[[{ 10, 'x' }]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceValuesUnderProject.json b/tests/benchmark/testReduceValuesUnderProject.json deleted file mode 100644 index c94adff..0000000 --- a/tests/benchmark/testReduceValuesUnderProject.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],[{"operator":"20","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}},{"values":{"schema":["INTEGER"],"content":[[{"operator":"11","operand":[],"type":"INTEGER"}],[{"operator":"23","operand":[],"type":"INTEGER"}]]}}],"help":["LogicalProject(EXPR$0=[+($0, $1)])\n LogicalValues(tuples=[[{ 10, 1 }, { 20, 3 }]])\n","LogicalValues(tuples=[[{ 11 }, { 23 }]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceValuesUnderProjectFilter.json b/tests/benchmark/testReduceValuesUnderProjectFilter.json deleted file mode 100644 index 503ce65..0000000 --- a/tests/benchmark/testReduceValuesUnderProjectFilter.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"project":{"target":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"<","operand":[{"operator":"-","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"21","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"values":{"schema":["INTEGER","INTEGER"],"content":[[{"operator":"10","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],[{"operator":"30","operand":[],"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],[{"operator":"20","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}]]}}}}}},{"values":{"schema":["INTEGER","INTEGER","INTEGER"],"content":[[{"operator":"11","operand":[],"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],[{"operator":"23","operand":[],"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}]]}}],"help":["LogicalProject(X=[+($0, $1)], B=[$1], A=[$0])\n LogicalFilter(condition=[<(-($0, $1), 21)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 7 }, { 20, 3 }]])\n","LogicalValues(tuples=[[{ 11, 1, 10 }, { 23, 3, 20 }]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testReduceWithNonTypePredicate.json b/tests/benchmark/testReduceWithNonTypePredicate.json deleted file mode 100644 index bfc5cd0..0000000 --- a/tests/benchmark/testReduceWithNonTypePredicate.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"AVG","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[AVG($0)], EXPR$1=[AVG($0) WITHIN DISTINCT ($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[$0], EXPR$1=[CAST(/(CASE(=($2, 0), null:INTEGER, $1), $2)):INTEGER])\n LogicalAggregate(group=[{}], EXPR$0=[AVG($0)], agg#1=[$SUM0($0) WITHIN DISTINCT ($1)], agg#2=[COUNT() WITHIN DISTINCT ($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRemoveDistinctOnAgg.json b/tests/benchmark/testRemoveDistinctOnAgg.json deleted file mode 100644 index 6ab1221..0000000 --- a/tests/benchmark/testRemoveDistinctOnAgg.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":4,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"BIT_AND","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"BIT_OR","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":4,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":"1","operand":[],"type":"BIGINT"}],"source":{"scan":0}}}],"help":["LogicalProject(EMPNO=[$0], EXPR$1=[$2], EXPR$2=[$3], EXPR$3=[$3], EXPR$4=[$4], EXPR$5=[$5], EXPR$6=[$6], EXPR$7=[$7])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM(DISTINCT $2)], EXPR$2=[MIN($2)], EXPR$4=[MAX($2)], EXPR$5=[BIT_AND($2)], EXPR$6=[BIT_OR($2)], EXPR$7=[COUNT(DISTINCT $2)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], EXPR$1=[$5], EXPR$2=[$5], EXPR$3=[$5], EXPR$4=[$5], EXPR$5=[$5], EXPR$6=[$5], EXPR$7=[1:BIGINT])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRemoveSemiJoin.json b/tests/benchmark/testRemoveSemiJoin.json deleted file mode 100644 index f800818..0000000 --- a/tests/benchmark/testRemoveSemiJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}],"help":["LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[=($1, $2)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(ENAME=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRemoveSemiJoinRight.json b/tests/benchmark/testRemoveSemiJoinRight.json deleted file mode 100644 index f3ef9a5..0000000 --- a/tests/benchmark/testRemoveSemiJoinRight.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}],"help":["LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[AND(=($1, $2), =($2, $3))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(ENAME=[$0])\n LogicalJoin(condition=[=($2, $3)], joinType=[inner])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRemoveSemiJoinRightWithFilter.json b/tests/benchmark/testRemoveSemiJoinRightWithFilter.json deleted file mode 100644 index a6384de..0000000 --- a/tests/benchmark/testRemoveSemiJoinRightWithFilter.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'foo'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'foo'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":1}}}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}],"help":["LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[AND(=($1, $2), =($2, $4), =($3, 'foo'))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(ENAME=[$0])\n LogicalJoin(condition=[=($2, $4)], joinType=[inner])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($1, 'foo')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRemoveSemiJoinWithFilter.json b/tests/benchmark/testRemoveSemiJoinWithFilter.json deleted file mode 100644 index f70a42a..0000000 --- a/tests/benchmark/testRemoveSemiJoinWithFilter.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["ENAME","DEPTNO"],"types":["VARCHAR","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'foo'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"operator":"_ISO-8859-1'foo'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[AND(=($1, $2), =($0, 'foo'))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(ENAME=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalFilter(condition=[=($0, 'foo')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRightEmptyAntiJoin.json b/tests/benchmark/testRightEmptyAntiJoin.json deleted file mode 100644 index 8a0a3be..0000000 --- a/tests/benchmark/testRightEmptyAntiJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["SMALLINT","TINYINT"],"nullable":[false,true],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"join":{"kind":"ANTI","condition":{"operator":"=","operand":[{"column":1,"type":"TINYINT"},{"column":2,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"values":{"schema":["TINYINT","VARCHAR","VARCHAR"],"content":[]}}}}}},{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"scan":0}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[anti])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n","LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[scott, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRightEmptyAntiJoinNonEqui.json b/tests/benchmark/testRightEmptyAntiJoinNonEqui.json deleted file mode 100644 index 1c4a3be..0000000 --- a/tests/benchmark/testRightEmptyAntiJoinNonEqui.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","SAL","DEPTNO"],"types":["SMALLINT","DECIMAL","TINYINT"],"nullable":[false,true,true],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"join":{"kind":"ANTI","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"TINYINT"},{"column":3,"type":"TINYINT"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"DECIMAL"},{"operator":"2000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"values":{"schema":["TINYINT","VARCHAR","VARCHAR"],"content":[]}}}}}},{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"scan":0}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[AND(=($2, $3), =($1, 2000))], joinType=[anti])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n","LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[scott, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRightEmptyFullJoin.json b/tests/benchmark/testRightEmptyFullJoin.json deleted file mode 100644 index 617c8e1..0000000 --- a/tests/benchmark/testRightEmptyFullJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"FULL","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"values":{"schema":["INTEGER","VARCHAR"],"content":[]}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRightEmptyInnerJoin.json b/tests/benchmark/testRightEmptyInnerJoin.json deleted file mode 100644 index 620b954..0000000 --- a/tests/benchmark/testRightEmptyInnerJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN","INTEGER","VARCHAR"],"content":[]}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRightEmptyLeftJoin.json b/tests/benchmark/testRightEmptyLeftJoin.json deleted file mode 100644 index 53550a2..0000000 --- a/tests/benchmark/testRightEmptyLeftJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"values":{"schema":["INTEGER","VARCHAR"],"content":[]}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRightEmptyRightJoin.json b/tests/benchmark/testRightEmptyRightJoin.json deleted file mode 100644 index a4c604e..0000000 --- a/tests/benchmark/testRightEmptyRightJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"false","operand":[],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"values":{"schema":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN","INTEGER","VARCHAR"],"content":[]}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRightEmptySemiJoin.json b/tests/benchmark/testRightEmptySemiJoin.json deleted file mode 100644 index aae9efc..0000000 --- a/tests/benchmark/testRightEmptySemiJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["SMALLINT","TINYINT"],"nullable":[false,true],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":1,"type":"TINYINT"},{"column":2,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"values":{"schema":["TINYINT","VARCHAR","VARCHAR"],"content":[]}}}}}},{"project":{"target":[{"column":0,"type":"SMALLINT"}],"source":{"values":{"schema":["SMALLINT","VARCHAR","VARCHAR","SMALLINT","DATE","DECIMAL","DECIMAL","TINYINT"],"content":[]}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n","LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testRightOuterJoinSimplificationToInner.json b/tests/benchmark/testRightOuterJoinSimplificationToInner.json deleted file mode 100644 index 8c6b5e2..0000000 --- a/tests/benchmark/testRightOuterJoinSimplificationToInner.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'Charlie'","operand":[],"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSemiJoinProjectTranspose.json b/tests/benchmark/testSemiJoinProjectTranspose.json deleted file mode 100644 index d814801..0000000 --- a/tests/benchmark/testSemiJoinProjectTranspose.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","DNAME","LOC"],"types":["TINYINT","VARCHAR","VARCHAR"],"nullable":[false,true,true],"key":[[0],[1],[2]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","DNAME","LOC"],"types":["TINYINT","VARCHAR","VARCHAR"],"nullable":[false,true,true],"key":[[0],[1],[2]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"TINYINT"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":0,"type":"TINYINT"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":1,"type":"TINYINT"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}},{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"TINYINT"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":0,"type":"TINYINT"}],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"*","operand":[{"operator":"2","operand":[],"type":"INTEGER"},{"column":1,"type":"TINYINT"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}],"help":["LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n","LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSemiJoinReduceConstants.json b/tests/benchmark/testSemiJoinReduceConstants.json deleted file mode 100644 index 4d1bde3..0000000 --- a/tests/benchmark/testSemiJoinReduceConstants.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"200","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"operator":"200","operand":[],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"200","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(SAL=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\n LogicalFilter(condition=[=($1, 200)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[=($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(SAL=[$0])\n LogicalJoin(condition=[=(200, $2)], joinType=[semi])\n LogicalFilter(condition=[=($1, 200)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[=($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSemiJoinRule.json b/tests/benchmark/testSemiJoinRule.json deleted file mode 100644 index 5957a85..0000000 --- a/tests/benchmark/testSemiJoinRule.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}}]}}}}}},{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}],"help":["LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSemiJoinRuleExists.json b/tests/benchmark/testSemiJoinRuleExists.json deleted file mode 100644 index 5957a85..0000000 --- a/tests/benchmark/testSemiJoinRuleExists.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}}]}}}}}},{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}],"help":["LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSemiJoinRuleLeft.json b/tests/benchmark/testSemiJoinRuleLeft.json deleted file mode 100644 index 936a48e..0000000 --- a/tests/benchmark/testSemiJoinRuleLeft.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}}]}}}}}},{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}],"help":["LogicalProject(NAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSemiJoinRuleWithHint.json b/tests/benchmark/testSemiJoinRuleWithHint.json deleted file mode 100644 index 295baa2..0000000 --- a/tests/benchmark/testSemiJoinRuleWithHint.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","DNAME"],"types":["TINYINT","VARCHAR"],"nullable":[false,true],"key":[[0],[1]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["TINYINT"],"nullable":[true],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":2,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"TINYINT"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":1,"type":"TINYINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}},{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"TINYINT"},{"column":2,"type":"TINYINT"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}],"help":["LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[scott, EMP]])\n","LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSemiJoinRuleWithJoinOnUniqueInput.json b/tests/benchmark/testSemiJoinRuleWithJoinOnUniqueInput.json deleted file mode 100644 index 47d911c..0000000 --- a/tests/benchmark/testSemiJoinRuleWithJoinOnUniqueInput.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSemiJoinTrim.json b/tests/benchmark/testSemiJoinTrim.json deleted file mode 100644 index 2184774..0000000 --- a/tests/benchmark/testSemiJoinTrim.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]},{"name":"ACCOUNT","fields":["ACCTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}},"right":{"scan":2}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}},"right":{"scan":2}}}}}],"help":["LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalJoin(condition=[=($0, $1)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, CUSTOMER, ACCOUNT]])\n","LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalJoin(condition=[=($0, $1)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, CUSTOMER, ACCOUNT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSimplifyFilter.json b/tests/benchmark/testSimplifyFilter.json deleted file mode 100644 index e688d85..0000000 --- a/tests/benchmark/testSimplifyFilter.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"5","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"3","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(>($0, 3), >($7, 5))])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>($0, 3)])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSkipReduceConstantsCaseEquals.json b/tests/benchmark/testSkipReduceConstantsCaseEquals.json deleted file mode 100644 index c48b457..0000000 --- a/tests/benchmark/testSkipReduceConstantsCaseEquals.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"-1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":12,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"-1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"},{"column":12,"type":"INTEGER"},{"column":13,"type":"TIMESTAMP"},{"column":14,"type":"INTEGER"},{"column":15,"type":"INTEGER"},{"column":16,"type":"INTEGER"},{"column":17,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"-1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"IS NOT NULL","operand":[{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"CAST","operand":[{"column":12,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"-1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":0}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalFilter(condition=[=(CASE(IS NOT NULL($3), CAST($3):INTEGER NOT NULL, -1), CASE(IS NOT NULL($12), CAST($12):INTEGER NOT NULL, -1))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[=(CASE(IS NOT NULL($3), CAST($3):INTEGER NOT NULL, -1), CASE(IS NOT NULL($12), CAST($12):INTEGER NOT NULL, -1))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSome.json b/tests/benchmark/testSome.json deleted file mode 100644 index b2891b5..0000000 --- a/tests/benchmark/testSome.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"> SOME","operand":[{"column":0,"type":"INTEGER"}],"query":{"scan":1},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":10,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":10,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<=","operand":[{"column":10,"type":"BIGINT"},{"column":11,"type":"BIGINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"BIGINT"},{"column":1,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[> SOME($0, {\nLogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(AND(>($0, $9), <>($10, 0)), AND(>($0, $9), <>($10, 0), IS NOT TRUE(>($0, $9)), <=($10, $11)))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(m=[$0], c=[$1], d=[$1])\n LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSomeWithEquality.json b/tests/benchmark/testSomeWithEquality.json deleted file mode 100644 index e500a9f..0000000 --- a/tests/benchmark/testSomeWithEquality.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IN","operand":[{"column":7,"type":"INTEGER"}],"query":{"scan":1},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IN($7, {\nLogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSomeWithEquality2.json b/tests/benchmark/testSomeWithEquality2.json deleted file mode 100644 index da30b99..0000000 --- a/tests/benchmark/testSomeWithEquality2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IN","operand":[{"column":1,"type":"VARCHAR"}],"query":{"scan":1},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":9,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"scan":1}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IN($1, {\nLogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($1, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSomeWithNotEquality.json b/tests/benchmark/testSomeWithNotEquality.json deleted file mode 100644 index 31236f3..0000000 --- a/tests/benchmark/testSomeWithNotEquality.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"<> SOME","operand":[{"column":7,"type":"INTEGER"}],"query":{"scan":1},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"<>","operand":[{"column":10,"type":"BIGINT"},{"column":9,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":"<=","operand":[{"column":10,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":7,"type":"INTEGER"},{"column":11,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":9,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":10,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":7,"type":"INTEGER"},{"column":11,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":9,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"OR","operand":[{"operator":"=","operand":[{"column":10,"type":"BIGINT"},{"column":9,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":10,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"<>","operand":[{"column":9,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"OR","operand":[{"operator":"=","operand":[{"column":10,"type":"BIGINT"},{"column":9,"type":"BIGINT"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":10,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<>","operand":[{"column":10,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"true","operand":[],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"BIGINT"},{"column":0,"type":"BIGINT"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":1}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MAX","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":1}}}}}]}}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[<> SOME($7, {\nLogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(AND(<>($10, $9), <=($10, 1), <>($7, $11), <>($9, 0)), AND(=($10, 1), <>($7, $11), <>($9, 0), OR(=($10, $9), >($10, 1))), AND(<>($9, 0), OR(=($10, $9), >($10, 1)), <>($10, 1)))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(c=[$0], d=[$0], m=[$1])\n LogicalAggregate(group=[{}], c=[COUNT()], m=[MAX($0)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinCopyInnerJoinOrderBy.json b/tests/benchmark/testSortJoinCopyInnerJoinOrderBy.json deleted file mode 100644 index b94baec..0000000 --- a/tests/benchmark/testSortJoinCopyInnerJoinOrderBy.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[5,"INTEGER","ASC"]],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[5,"INTEGER","ASC"]],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"sort":{"collation":[[5,"INTEGER","ASC"]],"source":{"scan":0}}},"right":{"scan":1}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinCopyInnerJoinOrderByLimit.json b/tests/benchmark/testSortJoinCopyInnerJoinOrderByLimit.json deleted file mode 100644 index b2cb5ff..0000000 --- a/tests/benchmark/testSortJoinCopyInnerJoinOrderByLimit.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[5,"INTEGER","ASC"]],"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[5,"INTEGER","ASC"]],"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"sort":{"collation":[[5,"INTEGER","ASC"]],"source":{"scan":0}}},"right":{"scan":1}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinCopyInnerJoinOrderByTwoFields.json b/tests/benchmark/testSortJoinCopyInnerJoinOrderByTwoFields.json deleted file mode 100644 index 518da19..0000000 --- a/tests/benchmark/testSortJoinCopyInnerJoinOrderByTwoFields.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[5,"INTEGER","ASC"],[10,"VARCHAR","ASC"]],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[5,"INTEGER","ASC"],[10,"VARCHAR","ASC"]],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"sort":{"collation":[[5,"INTEGER","ASC"]],"source":{"scan":0}}},"right":{"sort":{"collation":[[1,"VARCHAR","ASC"]],"source":{"scan":1}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], sort1=[$10], dir0=[ASC], dir1=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], sort1=[$10], dir0=[ASC], dir1=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalSort(sort0=[$1], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinCopySemiJoinOrderBy.json b/tests/benchmark/testSortJoinCopySemiJoinOrderBy.json deleted file mode 100644 index c8dddf4..0000000 --- a/tests/benchmark/testSortJoinCopySemiJoinOrderBy.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[0,"INTEGER","ASC"]],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"sort":{"collation":[[0,"INTEGER","ASC"]],"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"sort":{"collation":[[0,"INTEGER","ASC"]],"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinCopySemiJoinOrderByLimitOffset.json b/tests/benchmark/testSortJoinCopySemiJoinOrderByLimitOffset.json deleted file mode 100644 index 7f03af5..0000000 --- a/tests/benchmark/testSortJoinCopySemiJoinOrderByLimitOffset.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[0,"INTEGER","ASC"]],"offset":{"operator":"2","operand":[],"type":"INTEGER"},"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"sort":{"collation":[[0,"INTEGER","ASC"]],"offset":{"operator":"2","operand":[],"type":"INTEGER"},"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"sort":{"collation":[[0,"INTEGER","ASC"]],"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalSort(sort0=[$0], dir0=[ASC], offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalSort(sort0=[$0], dir0=[ASC], offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinCopySemiJoinOrderByOffset.json b/tests/benchmark/testSortJoinCopySemiJoinOrderByOffset.json deleted file mode 100644 index 535c170..0000000 --- a/tests/benchmark/testSortJoinCopySemiJoinOrderByOffset.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[0,"INTEGER","ASC"]],"offset":{"operator":"2","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"sort":{"collation":[[0,"INTEGER","ASC"]],"offset":{"operator":"2","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"SEMI","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"sort":{"collation":[[0,"INTEGER","ASC"]],"source":{"scan":0}}},"right":{"scan":1}}}}}],"help":["LogicalSort(sort0=[$0], dir0=[ASC], offset=[2])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalSort(sort0=[$0], dir0=[ASC], offset=[2])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinTranspose1.json b/tests/benchmark/testSortJoinTranspose1.json deleted file mode 100644 index f051959..0000000 --- a/tests/benchmark/testSortJoinTranspose1.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[5,"INTEGER","ASC"]],"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[5,"INTEGER","ASC"]],"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"sort":{"collation":[[5,"INTEGER","ASC"]],"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"scan":0}}},"right":{"scan":1}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinTranspose2.json b/tests/benchmark/testSortJoinTranspose2.json deleted file mode 100644 index 2929585..0000000 --- a/tests/benchmark/testSortJoinTranspose2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[10,"VARCHAR","ASC"]],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[10,"VARCHAR","ASC"]],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"sort":{"collation":[[1,"VARCHAR","ASC"]],"source":{"scan":1}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalSort(sort0=[$1], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinTranspose4.json b/tests/benchmark/testSortJoinTranspose4.json deleted file mode 100644 index 2929585..0000000 --- a/tests/benchmark/testSortJoinTranspose4.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[10,"VARCHAR","ASC"]],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"},{"column":9,"type":"INTEGER"},{"column":10,"type":"VARCHAR"}],"source":{"sort":{"collation":[[10,"VARCHAR","ASC"]],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"sort":{"collation":[[1,"VARCHAR","ASC"]],"source":{"scan":1}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalSort(sort0=[$1], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortJoinTranspose6.json b/tests/benchmark/testSortJoinTranspose6.json deleted file mode 100644 index 5837004..0000000 --- a/tests/benchmark/testSortJoinTranspose6.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"sort":{"collation":[],"offset":{"operator":"2","operand":[],"type":"INTEGER"},"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"sort":{"collation":[],"offset":{"operator":"2","operand":[],"type":"INTEGER"},"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"sort":{"collation":[],"offset":{"operator":"2","operand":[],"type":"INTEGER"},"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"scan":1}}}}}}}}}],"help":["LogicalProject(DEPTNO=[$0], EMPNO=[$1])\n LogicalSort(offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EMPNO=[$1])\n LogicalSort(offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalSort(offset=[2], fetch=[10])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortProjectTranspose1.json b/tests/benchmark/testSortProjectTranspose1.json deleted file mode 100644 index 4f59319..0000000 --- a/tests/benchmark/testSortProjectTranspose1.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[1,"INTEGER","ASC"]],"offset":{"operator":"1","operand":[],"type":"INTEGER"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"sort":{"collation":[[0,"INTEGER","ASC"]],"offset":{"operator":"1","operand":[],"type":"INTEGER"},"source":{"scan":0}}}}}],"help":["LogicalSort(sort0=[$1], dir0=[ASC], offset=[1])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[$0])\n LogicalSort(sort0=[$0], dir0=[ASC], offset=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortProjectTranspose2.json b/tests/benchmark/testSortProjectTranspose2.json deleted file mode 100644 index 34aa6d5..0000000 --- a/tests/benchmark/testSortProjectTranspose2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[1,"DOUBLE","ASC"]],"offset":{"operator":"1","operand":[],"type":"INTEGER"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CAST","operand":[{"column":0,"type":"INTEGER"}],"type":"DOUBLE"}],"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CAST","operand":[{"column":0,"type":"INTEGER"}],"type":"DOUBLE"}],"source":{"sort":{"collation":[[0,"INTEGER","ASC"]],"offset":{"operator":"1","operand":[],"type":"INTEGER"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}}}}],"help":["LogicalSort(sort0=[$1], dir0=[ASC], offset=[1])\n LogicalProject(DEPTNO=[$0], EXPR$1=[CAST($0):DOUBLE NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[CAST($0):DOUBLE NOT NULL])\n LogicalSort(sort0=[$0], dir0=[ASC], offset=[1])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortRemovalAllKeysConstant.json b/tests/benchmark/testSortRemovalAllKeysConstant.json deleted file mode 100644 index e19fc72..0000000 --- a/tests/benchmark/testSortRemovalAllKeysConstant.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[1,"INTEGER","DESC-nulls-last"]],"source":{"project":{"target":[{"column":2,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}},{"project":{"target":[{"column":2,"type":"BIGINT"},{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}],"help":["LogicalSort(sort0=[$1], dir0=[DESC-nulls-last])\n LogicalProject(C=[$2], DEPTNO=[$0])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$1], SAL=[$0])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(C=[$2], DEPTNO=[$0])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$1], SAL=[$0])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortRemovalOneKeyConstant.json b/tests/benchmark/testSortRemovalOneKeyConstant.json deleted file mode 100644 index 1ee2b6a..0000000 --- a/tests/benchmark/testSortRemovalOneKeyConstant.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[1,"INTEGER","ASC"],[2,"INTEGER","DESC"]],"source":{"project":{"target":[{"column":2,"type":"BIGINT"},{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}},{"sort":{"collation":[[2,"INTEGER","DESC"]],"source":{"project":{"target":[{"column":2,"type":"BIGINT"},{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}]}}}}}}],"help":["LogicalSort(sort0=[$1], sort1=[$2], dir0=[ASC], dir1=[DESC])\n LogicalProject(C=[$2], DEPTNO=[$0], SAL=[$1])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$1], SAL=[$0])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalSort(sort0=[$2], dir0=[DESC])\n LogicalProject(C=[$2], DEPTNO=[$0], SAL=[$1])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$1], SAL=[$0])\n LogicalFilter(condition=[=($1, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortUnionTranspose.json b/tests/benchmark/testSortUnionTranspose.json deleted file mode 100644 index da2d9c2..0000000 --- a/tests/benchmark/testSortUnionTranspose.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[0,"VARCHAR","ASC"]],"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"union":[{"scan":0},{"scan":0}]}}},{"sort":{"collation":[[0,"VARCHAR","ASC"]],"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"union":[{"sort":{"collation":[[0,"VARCHAR","ASC"]],"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"scan":0}}},{"sort":{"collation":[[0,"VARCHAR","ASC"]],"limit":{"operator":"10","operand":[],"type":"INTEGER"},"source":{"scan":0}}}]}}}],"help":["LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalUnion(all=[true])\n LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortUnionTranspose2.json b/tests/benchmark/testSortUnionTranspose2.json deleted file mode 100644 index a976faa..0000000 --- a/tests/benchmark/testSortUnionTranspose2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["NAME"],"types":["VARCHAR"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"sort":{"collation":[[0,"VARCHAR","ASC"]],"source":{"union":[{"scan":0},{"scan":0}]}}},{"sort":{"collation":[[0,"VARCHAR","ASC"]],"source":{"union":[{"sort":{"collation":[[0,"VARCHAR","ASC"]],"source":{"scan":0}}},{"sort":{"collation":[[0,"VARCHAR","ASC"]],"source":{"scan":0}}}]}}}],"help":["LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalUnion(all=[true])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSortUnionTranspose3.json b/tests/benchmark/testSortUnionTranspose3.json deleted file mode 100644 index 9bba2c7..0000000 --- a/tests/benchmark/testSortUnionTranspose3.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[],"queries":[{"values":{"schema":["VARCHAR"],"content":[]}},{"values":{"schema":["VARCHAR"],"content":[]}}],"help":["LogicalValues(tuples=[[]])\n","LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSpatialContainsPoint.json b/tests/benchmark/testSpatialContainsPoint.json deleted file mode 100644 index 4d15ff0..0000000 --- a/tests/benchmark/testSpatialContainsPoint.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"RESTAURANTS","fields":["NAME","LATITUDE","LONGITUDE","CUISINE","HILBERT"],"types":["VARCHAR","INTEGER","INTEGER","VARCHAR","BIGINT"],"nullable":[false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"ST_CONTAINS","operand":[{"operator":"ST_BUFFER","operand":[{"operator":"ST_POINT","operand":[{"operator":"10.0","operand":[],"type":"DECIMAL"},{"operator":"20.0","operand":[],"type":"DECIMAL"}],"type":"GEOMETRY"},{"operator":"6","operand":[],"type":"INTEGER"}],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"SEARCH","operand":[{"column":4,"type":"BIGINT"},{"operator":"Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"ST_CONTAINS","operand":[{"operator":"POLYGON ((16 20, 15.884711682419383 18.829458067903232, 15.54327719506772 17.703899405809462, 14.988817673815271 16.666578601882385, 14.242640687119286 15.757359312880716, 13.333421398117615 15.011182326184729, 12.29610059419054 14.45672280493228, 11.17054193209677 14.115288317580617, 10 14, 8.82945806790323 14.115288317580617, 7.703899405809461 14.45672280493228, 6.666578601882389 15.011182326184727, 5.757359312880715 15.757359312880714, 5.011182326184728 16.666578601882385, 4.45672280493228 17.70389940580946, 4.115288317580617 18.82945806790323, 4 20, 4.115288317580617 21.17054193209677, 4.456722804932279 22.296100594190538, 5.011182326184727 23.33342139811761, 5.757359312880714 24.242640687119284, 6.666578601882387 24.98881767381527, 7.703899405809458 25.54327719506772, 8.829458067903229 25.884711682419383, 9.999999999999998 26, 11.17054193209677 25.884711682419383, 12.29610059419054 25.54327719506772, 13.333421398117611 24.988817673815273, 14.242640687119284 24.242640687119284, 14.988817673815271 23.333421398117615, 15.54327719506772 22.29610059419054, 15.884711682419383 21.17054193209677, 16 20))","operand":[],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_CONTAINS(ST_BUFFER(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), 6), ST_POINT($2, $1))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n","LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]), ST_CONTAINS(POLYGON ((16 20, 15.884711682419383 18.829458067903232, 15.54327719506772 17.703899405809462, 14.988817673815271 16.666578601882385, 14.242640687119286 15.757359312880716, 13.333421398117615 15.011182326184729, 12.29610059419054 14.45672280493228, 11.17054193209677 14.115288317580617, 10 14, 8.82945806790323 14.115288317580617, 7.703899405809461 14.45672280493228, 6.666578601882389 15.011182326184727, 5.757359312880715 15.757359312880714, 5.011182326184728 16.666578601882385, 4.45672280493228 17.70389940580946, 4.115288317580617 18.82945806790323, 4 20, 4.115288317580617 21.17054193209677, 4.456722804932279 22.296100594190538, 5.011182326184727 23.33342139811761, 5.757359312880714 24.242640687119284, 6.666578601882387 24.98881767381527, 7.703899405809458 25.54327719506772, 8.829458067903229 25.884711682419383, 9.999999999999998 26, 11.17054193209677 25.884711682419383, 12.29610059419054 25.54327719506772, 13.333421398117611 24.988817673815273, 14.242640687119284 24.242640687119284, 14.988817673815271 23.333421398117615, 15.54327719506772 22.29610059419054, 15.884711682419383 21.17054193209677, 16 20)):GEOMETRY, ST_POINT($2, $1)))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSpatialDWithinLine.json b/tests/benchmark/testSpatialDWithinLine.json deleted file mode 100644 index cf2d993..0000000 --- a/tests/benchmark/testSpatialDWithinLine.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"RESTAURANTS","fields":["NAME","LATITUDE","LONGITUDE","CUISINE","HILBERT"],"types":["VARCHAR","INTEGER","INTEGER","VARCHAR","BIGINT"],"nullable":[false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"ST_DWITHIN","operand":[{"operator":"ST_MAKELINE","operand":[{"operator":"ST_POINT","operand":[{"operator":"8.0","operand":[],"type":"DECIMAL"},{"operator":"20.0","operand":[],"type":"DECIMAL"}],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"operator":"12.0","operand":[],"type":"DECIMAL"},{"operator":"20.0","operand":[],"type":"DECIMAL"}],"type":"GEOMETRY"}],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"SEARCH","operand":[{"column":4,"type":"BIGINT"},{"operator":"Sarg[[33064..33076], [33092..33100], [33112..33156], [33164..33176], [33236..33240], [36457..36459], [36501..36503], [36505..36507], [36517..36519]]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"ST_DWITHIN","operand":[{"operator":"LINESTRING (8 20, 12 20)","operand":[],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_MAKELINE(ST_POINT(8.0:DECIMAL(2, 1), 20.0:DECIMAL(3, 1)), ST_POINT(12.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1))), ST_POINT($2, $1), 4)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n","LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[33064..33076], [33092..33100], [33112..33156], [33164..33176], [33236..33240], [36457..36459], [36501..36503], [36505..36507], [36517..36519]]), ST_DWITHIN(LINESTRING (8 20, 12 20):GEOMETRY, ST_POINT($2, $1), 4))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSpatialDWithinReversed.json b/tests/benchmark/testSpatialDWithinReversed.json deleted file mode 100644 index af852a6..0000000 --- a/tests/benchmark/testSpatialDWithinReversed.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"RESTAURANTS","fields":["NAME","LATITUDE","LONGITUDE","CUISINE","HILBERT"],"types":["VARCHAR","INTEGER","INTEGER","VARCHAR","BIGINT"],"nullable":[false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"ST_DWITHIN","operand":[{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"operator":"10.0","operand":[],"type":"DECIMAL"},{"operator":"20.0","operand":[],"type":"DECIMAL"}],"type":"GEOMETRY"},{"operator":"6","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"SEARCH","operand":[{"column":4,"type":"BIGINT"},{"operator":"Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"ST_DWITHIN","operand":[{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"},{"operator":"POINT (10 20)","operand":[],"type":"GEOMETRY"},{"operator":"6","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT($2, $1), ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), 6)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n","LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]), ST_DWITHIN(ST_POINT($2, $1), POINT (10 20):GEOMETRY, 6))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSpatialDWithinToHilbert.json b/tests/benchmark/testSpatialDWithinToHilbert.json deleted file mode 100644 index 594e401..0000000 --- a/tests/benchmark/testSpatialDWithinToHilbert.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"RESTAURANTS","fields":["NAME","LATITUDE","LONGITUDE","CUISINE","HILBERT"],"types":["VARCHAR","INTEGER","INTEGER","VARCHAR","BIGINT"],"nullable":[false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"ST_DWITHIN","operand":[{"operator":"ST_POINT","operand":[{"operator":"10.0","operand":[],"type":"DECIMAL"},{"operator":"20.0","operand":[],"type":"DECIMAL"}],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"SEARCH","operand":[{"column":4,"type":"BIGINT"},{"operator":"Sarg[[28988..28989], [28991..28994], [29006..29009], [29011..29014], [32426..32429], [32431..32434], [32446..32449], [32451..32454], [32506..32509], [32511..32514], [32526..32527], [32929..32930], [32942..32949], [32951..32953], [32955..32970], [32973..32975], [33009..33011], [33014..33185], [33187..33190], [33205..33207], [33209..33211], [33226..33229], [33231..33265], [33267..33270], [36392..36401], [36403..36404], [36421..36423], [36425..36427], [36442..36445], [36447..36548], [36556..36568]]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"ST_DWITHIN","operand":[{"operator":"POINT (10 20)","operand":[],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), ST_POINT($2, $1), 10)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n","LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[28988..28989], [28991..28994], [29006..29009], [29011..29014], [32426..32429], [32431..32434], [32446..32449], [32451..32454], [32506..32509], [32511..32514], [32526..32527], [32929..32930], [32942..32949], [32951..32953], [32955..32970], [32973..32975], [33009..33011], [33014..33185], [33187..33190], [33205..33207], [33209..33211], [33226..33229], [33231..33265], [33267..33270], [36392..36401], [36403..36404], [36421..36423], [36425..36427], [36442..36445], [36447..36548], [36556..36568]]), ST_DWITHIN(POINT (10 20):GEOMETRY, ST_POINT($2, $1), 10))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSpatialDWithinToHilbertNegative.json b/tests/benchmark/testSpatialDWithinToHilbertNegative.json deleted file mode 100644 index db148ec..0000000 --- a/tests/benchmark/testSpatialDWithinToHilbertNegative.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"RESTAURANTS","fields":["NAME","LATITUDE","LONGITUDE","CUISINE","HILBERT"],"types":["VARCHAR","INTEGER","INTEGER","VARCHAR","BIGINT"],"nullable":[false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"ST_DWITHIN","operand":[{"operator":"ST_POINT","operand":[{"operator":"10.0","operand":[],"type":"DECIMAL"},{"operator":"20.0","operand":[],"type":"DECIMAL"}],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"},{"operator":"-2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"values":{"schema":["VARCHAR","INTEGER","INTEGER","VARCHAR","BIGINT"],"content":[]}}}}],"help":["LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), ST_POINT($2, $1), -2)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n","LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalValues(tuples=[[]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSpatialDWithinToHilbertZero.json b/tests/benchmark/testSpatialDWithinToHilbertZero.json deleted file mode 100644 index b53c925..0000000 --- a/tests/benchmark/testSpatialDWithinToHilbertZero.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"RESTAURANTS","fields":["NAME","LATITUDE","LONGITUDE","CUISINE","HILBERT"],"types":["VARCHAR","INTEGER","INTEGER","VARCHAR","BIGINT"],"nullable":[false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"ST_DWITHIN","operand":[{"operator":"ST_POINT","operand":[{"operator":"10.0","operand":[],"type":"DECIMAL"},{"operator":"20.0","operand":[],"type":"DECIMAL"}],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"33139","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"operator":"POINT (10 20)","operand":[],"type":"GEOMETRY"},{"operator":"ST_POINT","operand":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"GEOMETRY"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}],"help":["LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), ST_POINT($2, $1), 0)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n","LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(=($4, 33139), =(POINT (10 20), ST_POINT($2, $1)))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSpatialReduce.json b/tests/benchmark/testSpatialReduce.json deleted file mode 100644 index 76aedcb..0000000 --- a/tests/benchmark/testSpatialReduce.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"RESTAURANTS","fields":["NAME","LATITUDE","LONGITUDE","CUISINE","HILBERT"],"types":["VARCHAR","INTEGER","INTEGER","VARCHAR","BIGINT"],"nullable":[false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"ST_BUFFER","operand":[{"operator":"ST_POINT","operand":[{"operator":"0.0","operand":[],"type":"DECIMAL"},{"operator":"0.0","operand":[],"type":"DECIMAL"}],"type":"GEOMETRY"},{"operator":"1","operand":[],"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"GEOMETRY"}],"source":{"scan":0}}},{"project":{"target":[{"operator":"CAST","operand":[{"operator":"POLYGON ((1 0, 0.9238795325112867 -0.3826834323650898, 0.7071067811865476 -0.7071067811865475, 0.3826834323650898 -0.9238795325112867, 0.0000000000000001 -1, -0.3826834323650897 -0.9238795325112867, -0.7071067811865475 -0.7071067811865476, -0.9238795325112867 -0.3826834323650899, -1 -0.0000000000000001, -0.9238795325112868 0.3826834323650897, -0.7071067811865477 0.7071067811865475, -0.3826834323650903 0.9238795325112865, -0.0000000000000002 1, 0.38268343236509 0.9238795325112866, 0.7071067811865474 0.7071067811865477, 0.9238795325112865 0.3826834323650904, 1 0))","operand":[],"type":"GEOMETRY"}],"type":"GEOMETRY"}],"source":{"scan":0}}}],"help":["LogicalProject(B=[ST_BUFFER(ST_POINT(0.0:DECIMAL(2, 1), 0.0:DECIMAL(2, 1)), 1, 4)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n","LogicalProject(B=[CAST(POLYGON ((1 0, 0.9238795325112867 -0.3826834323650898, 0.7071067811865476 -0.7071067811865475, 0.3826834323650898 -0.9238795325112867, 0.0000000000000001 -1, -0.3826834323650897 -0.9238795325112867, -0.7071067811865475 -0.7071067811865476, -0.9238795325112867 -0.3826834323650899, -1 -0.0000000000000001, -0.9238795325112868 0.3826834323650897, -0.7071067811865477 0.7071067811865475, -0.3826834323650903 0.9238795325112865, -0.0000000000000002 1, 0.38268343236509 0.9238795325112866, 0.7071067811865474 0.7071067811865477, 0.9238795325112865 0.3826834323650904, 1 0)):GEOMETRY):GEOMETRY])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testStrengthenJoinType.json b/tests/benchmark/testStrengthenJoinType.json deleted file mode 100644 index e6c256d..0000000 --- a/tests/benchmark/testStrengthenJoinType.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":6,"type":"TIMESTAMP"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":10,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"IS NOT NULL","operand":[{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"column":6,"type":"TIMESTAMP"},{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":10,"type":"BOOLEAN"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"operator":"CAST","operand":[{"column":2,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"column":3,"type":"VARCHAR"}],"type":"VARCHAR"},{"operator":"CAST","operand":[{"column":4,"type":"VARCHAR"}],"type":"VARCHAR"},{"column":5,"type":"INTEGER"},{"operator":"CAST","operand":[{"column":6,"type":"TIMESTAMP"}],"type":"TIMESTAMP"},{"operator":"CAST","operand":[{"column":7,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"column":8,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"column":9,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"column":10,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"filter":{"condition":{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"100","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}}}}}}],"help":["LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalFilter(condition=[AND(IS NOT NULL($9), >($7, 100))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[CAST($2):INTEGER], ENAME=[CAST($3):VARCHAR(20)], JOB=[CAST($4):VARCHAR(10)], MGR=[$5], HIREDATE=[CAST($6):TIMESTAMP(0)], SAL=[CAST($7):INTEGER], COMM=[CAST($8):INTEGER], DEPTNO0=[CAST($9):INTEGER], SLACKER=[CAST($10):BOOLEAN])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSumAndDistinctSumWithExpandSumType.json b/tests/benchmark/testSumAndDistinctSumWithExpandSumType.json deleted file mode 100644 index 216de04..0000000 --- a/tests/benchmark/testSumAndDistinctSumWithExpandSumType.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["COMM"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}},{"project":{"target":[{"operator":"CAST","operand":[{"column":0,"type":"DECIMAL"}],"type":"BIGINT"},{"column":1,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"BIGINT"}],"distinct":false,"ignoreNulls":false,"type":"DECIMAL"},{"operator":"SUM","operand":[{"column":0,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":1,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}]}}}}}}]}}}}],"help":["LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[SUM(DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[CAST($0):BIGINT], EXPR$1=[$1])\n LogicalAggregate(group=[{}], EXPR$0=[SUM($1)], EXPR$1=[SUM($0)])\n LogicalAggregate(group=[{0}], EXPR$0=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testSwapOuterJoin.json b/tests/benchmark/testSwapOuterJoin.json deleted file mode 100644 index 39652a9..0000000 --- a/tests/benchmark/testSwapOuterJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":0,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":1},"right":{"scan":0}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceAggregate.json b/tests/benchmark/testTransitiveInferenceAggregate.json deleted file mode 100644 index 988d833..0000000 --- a/tests/benchmark/testTransitiveInferenceAggregate.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},"right":{"scan":0}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{0}])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{0}])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceComplexPredicate.json b/tests/benchmark/testTransitiveInferenceComplexPredicate.json deleted file mode 100644 index 84b2548..0000000 --- a/tests/benchmark/testTransitiveInferenceComplexPredicate.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["SAL","COMM","DEPTNO"],"types":["INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"AND","operand":[{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"/","operand":[{"column":0,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},"right":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"AND","operand":[{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"operator":"+","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"/","operand":[{"column":0,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($1, $3)], joinType=[inner])\n LogicalFilter(condition=[AND(>($1, 7), =($0, $1), >(+($0, $1), /($0, 2)))])\n LogicalProject(COMM=[$1], DEPTNO=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($0, $1)])\n LogicalProject(SAL=[$0], DEPTNO=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($1, $3)], joinType=[inner])\n LogicalFilter(condition=[AND(>($1, 7), =($0, $1), >(+($0, $1), /($0, 2)))])\n LogicalProject(COMM=[$1], DEPTNO=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($1, 7)])\n LogicalFilter(condition=[=($0, $1)])\n LogicalProject(SAL=[$0], DEPTNO=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceConjunctInPullUp.json b/tests/benchmark/testTransitiveInferenceConjunctInPullUp.json deleted file mode 100644 index 64e7e22..0000000 --- a/tests/benchmark/testTransitiveInferenceConjunctInPullUp.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":0,"type":"INTEGER"},{"operator":"Sarg[7, 9, (10..+∞)]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":0}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":0,"type":"INTEGER"},{"operator":"Sarg[7, 9, (10..+∞)]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":"SEARCH","operand":[{"column":0,"type":"INTEGER"},{"operator":"Sarg[7, 9, (10..+∞)]","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[SEARCH($0, Sarg[7, 9, (10..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[SEARCH($0, Sarg[7, 9, (10..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[SEARCH($0, Sarg[7, 9, (10..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceJoin.json b/tests/benchmark/testTransitiveInferenceJoin.json deleted file mode 100644 index 45850d2..0000000 --- a/tests/benchmark/testTransitiveInferenceJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceJoin3way.json b/tests/benchmark/testTransitiveInferenceJoin3way.json deleted file mode 100644 index e17c6ce..0000000 --- a/tests/benchmark/testTransitiveInferenceJoin3way.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":0}}},"right":{"scan":0}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceJoin3wayAgg.json b/tests/benchmark/testTransitiveInferenceJoin3wayAgg.json deleted file mode 100644 index c4022f0..0000000 --- a/tests/benchmark/testTransitiveInferenceJoin3wayAgg.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},"right":{"scan":0}}},"right":{"scan":0}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}]}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{0}])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{0}])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceLeftOuterJoin.json b/tests/benchmark/testTransitiveInferenceLeftOuterJoin.json deleted file mode 100644 index daa1b84..0000000 --- a/tests/benchmark/testTransitiveInferenceLeftOuterJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"9","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":0}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"9","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($1, 9)])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($1, 9)])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceProject.json b/tests/benchmark/testTransitiveInferenceProject.json deleted file mode 100644 index 45d5905..0000000 --- a/tests/benchmark/testTransitiveInferenceProject.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"scan":0}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferencePullUpThruAlias.json b/tests/benchmark/testTransitiveInferencePullUpThruAlias.json deleted file mode 100644 index e510e2b..0000000 --- a/tests/benchmark/testTransitiveInferencePullUpThruAlias.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["COMM","DEPTNO"],"types":["INTEGER","INTEGER"],"nullable":[false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[>($0, 7)])\n LogicalProject(COMM=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[>($0, 7)])\n LogicalProject(COMM=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalProject(DEPTNO=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceRightOuterJoin.json b/tests/benchmark/testTransitiveInferenceRightOuterJoin.json deleted file mode 100644 index 085c33b..0000000 --- a/tests/benchmark/testTransitiveInferenceRightOuterJoin.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"9","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"join":{"kind":"RIGHT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"9","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"9","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($0, 7)])\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 9)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($0, 7)])\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\n LogicalFilter(condition=[>($0, 9)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 9)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceUnion.json b/tests/benchmark/testTransitiveInferenceUnion.json deleted file mode 100644 index ad53bba..0000000 --- a/tests/benchmark/testTransitiveInferenceUnion.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"union":[{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}]},"right":{"scan":0}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"union":[{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}]},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceUnion3way.json b/tests/benchmark/testTransitiveInferenceUnion3way.json deleted file mode 100644 index f3b7b76..0000000 --- a/tests/benchmark/testTransitiveInferenceUnion3way.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"union":[{"union":[{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}]},{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}]},"right":{"scan":0}}}}},{"project":{"target":[{"operator":"1","operand":[],"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"union":[{"union":[{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}]},{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}]},"right":{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}}}}],"help":["LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalUnion(all=[true])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalUnion(all=[true])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($0, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testTransitiveInferenceUnionAlwaysTrue.json b/tests/benchmark/testTransitiveInferenceUnionAlwaysTrue.json deleted file mode 100644 index 67260ef..0000000 --- a/tests/benchmark/testTransitiveInferenceUnionAlwaysTrue.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["DEPTNO"],"types":["INTEGER"],"nullable":[false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"union":[{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"scan":0}]}}},{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},"right":{"filter":{"condition":{"operator":"<","operand":[{"column":0,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"union":[{"filter":{"condition":{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"operator":"7","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}},{"scan":0}]}}}}}],"help":["LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[<($0, 4)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalUnion(all=[true])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalFilter(condition=[<($0, 4)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[<($0, 4)])\n LogicalUnion(all=[true])\n LogicalFilter(condition=[>($0, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json b/tests/benchmark/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json deleted file mode 100644 index 7e0c61c..0000000 --- a/tests/benchmark/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":9,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"<","operand":[{"operator":"+","operand":[{"column":9,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">=","operand":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"30","operand":[],"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":9,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"<","operand":[{"operator":"+","operand":[{"column":9,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">=","operand":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"30","operand":[],"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"IS NOT NULL","operand":[{"column":9,"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"correlate":[{"scan":0},{"distinct":{"correlate":[{"project":{"target":[],"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"<","operand":[{"operator":"+","operand":[{"column":9,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">=","operand":[{"column":7,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"30","operand":[],"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":9,"type":"BOOLEAN"}],"distinct":false,"ignoreNulls":false,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[],"type":"BOOLEAN"},"source":{"project":{"target":[{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"<","operand":[{"operator":"+","operand":[{"column":9,"type":"INTEGER"},{"operator":"50","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"operator":"20","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">=","operand":[{"column":7,"type":"INTEGER"},{"column":10,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"+","operand":[{"operator":"30","operand":[],"type":"INTEGER"},{"column":16,"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[AND(<(+($0, 50), 20), >=($cor0.DEPTNO, +(30, $1)))])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[AND(<(+($0, 50), 20), >=($cor0.DEPTNO, $1))])\n LogicalProject(EMPNO=[$0], $f9=[+(30, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testUnionMergeRule.json b/tests/benchmark/testUnionMergeRule.json deleted file mode 100644 index 474b604..0000000 --- a/tests/benchmark/testUnionMergeRule.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"union":[{"union":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"union":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}]}]},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}]},{"union":[{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}},{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":0}}}]}],"help":["LogicalUnion(all=[true])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalUnion(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testUnionToDistinctRule.json b/tests/benchmark/testUnionToDistinctRule.json deleted file mode 100644 index 3e1e4c1..0000000 --- a/tests/benchmark/testUnionToDistinctRule.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"union":[{"scan":0},{"scan":0}]}},{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"union":[{"scan":0},{"scan":0}]}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":3,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"union":[{"scan":0},{"scan":0}]}}}}}]}}],"help":["LogicalUnion(all=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWhereAnyCorrelatedInSelect.json b/tests/benchmark/testWhereAnyCorrelatedInSelect.json deleted file mode 100644 index e9eecbe..0000000 --- a/tests/benchmark/testWhereAnyCorrelatedInSelect.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"> SOME","operand":[{"column":0,"type":"INTEGER"}],"query":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":10,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":1}}}}},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":13,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":"OR","operand":[{"operator":"IS NULL","operand":[{"column":12,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":10,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":"OR","operand":[{"operator":"IS NULL","operand":[{"column":12,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":10,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":">","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":">","operand":[{"column":10,"type":"BIGINT"},{"column":11,"type":"BIGINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"BIGINT"},{"column":2,"type":"BIGINT"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"column":0,"type":"VARCHAR"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":1,"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[> SOME($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[AND(=($2, $13), OR(AND(>($0, $9), IS NOT TRUE(OR(IS NULL($12), =($10, 0)))), AND(>($0, $9), IS NOT TRUE(OR(IS NULL($12), =($10, 0))), IS NOT TRUE(>($0, $9)), IS NOT TRUE(>($10, $11)))))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(m=[$1], c=[$2], d=[$2], trueLiteral=[true], NAME=[$0])\n LogicalAggregate(group=[{0}], m=[MIN($1)], c=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWhereExpressionInCorrelated.json b/tests/benchmark/testWhereExpressionInCorrelated.json deleted file mode 100644 index fa53242..0000000 --- a/tests/benchmark/testWhereExpressionInCorrelated.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"IN","operand":[{"column":1,"type":"INTEGER"}],"query":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"+","operand":[{"column":8,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}],"help":["LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[IN($1, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[=(+($5, 1), $cor0.SALPLUS)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalProject(ENAME=[$1], DEPTNO=[$7], SALPLUS=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(ENAME=[$0])\n LogicalJoin(condition=[AND(=($2, $4), =($1, $3))], joinType=[inner])\n LogicalProject(ENAME=[$1], DEPTNO=[$7], SALPLUS=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], $f9=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWhereExpressionInCorrelated2.json b/tests/benchmark/testWhereExpressionInCorrelated2.json deleted file mode 100644 index 5d97d71..0000000 --- a/tests/benchmark/testWhereExpressionInCorrelated2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":"IN","operand":[{"column":1,"type":"INTEGER"}],"query":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"operator":"+","operand":[{"column":8,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":1}}}}},"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"},{"operator":"-","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}}}}}},{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"},{"operator":"-","operand":[{"column":0,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":0}}},"right":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"operator":"+","operand":[{"column":5,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"operator":"+","operand":[{"column":7,"type":"INTEGER"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"INTEGER"}],"source":{"scan":1}}}}}}}]}}}}}}],"help":["LogicalProject(NAME=[$0])\n LogicalFilter(condition=[IN($1, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[=(+($5, 1), $cor0.DEPTNOMINUS)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalProject(NAME=[$1], DEPTNO=[$0], DEPTNOMINUS=[-($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(NAME=[$0])\n LogicalJoin(condition=[AND(=($2, $4), =($1, $3))], joinType=[inner])\n LogicalProject(NAME=[$1], DEPTNO=[$0], DEPTNOMINUS=[-($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], $f9=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWhereInCorrelated.json b/tests/benchmark/testWhereInCorrelated.json deleted file mode 100644 index c71ffac..0000000 --- a/tests/benchmark/testWhereInCorrelated.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","JOB","SAL"],"types":["INTEGER","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IN","operand":[{"column":0,"type":"INTEGER"}],"query":{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":1}}}}},"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"join":{"kind":"INNER","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}}}}],"help":["LogicalProject(SAL=[$2])\n LogicalFilter(condition=[IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(SAL=[$2])\n LogicalJoin(condition=[AND(=($1, $4), =($0, $3))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWhereInJoinCorrelated.json b/tests/benchmark/testWhereInJoinCorrelated.json deleted file mode 100644 index 2dfb9e9..0000000 --- a/tests/benchmark/testWhereInJoinCorrelated.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"IN","operand":[{"column":1,"type":"INTEGER"}],"query":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":11,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},"type":"BOOLEAN"},"source":{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"scan":1}}}}}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"column":11,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"correlate":[{"join":{"kind":"INNER","condition":{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"scan":1}}},{"distinct":{"correlate":[{"project":{"target":[{"column":11,"type":"INTEGER"}],"source":{"project":{"target":[{"column":11,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":12,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":16,"type":"INTEGER"},{"column":18,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":11,"type":"INTEGER"},{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":12,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":13,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":17,"type":"INTEGER"},{"column":19,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}]}}}}}],"help":["LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IN($1, {\nLogicalProject(SAL=[$5])\n LogicalFilter(condition=[>($7, $cor0.DEPTNO)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalJoin(condition=[=($2, $3)], joinType=[inner])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n","LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=($5, $11)])\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{7}])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(SAL=[$0])\n LogicalFilter(condition=[>($1, $cor0.DEPTNO)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWhereNotInCorrelated.json b/tests/benchmark/testWhereNotInCorrelated.json deleted file mode 100644 index 022eddf..0000000 --- a/tests/benchmark/testWhereNotInCorrelated.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","JOB","SAL"],"types":["INTEGER","VARCHAR","INTEGER"],"nullable":[false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"NOT","operand":[{"operator":"IN","operand":[{"column":0,"type":"INTEGER"}],"query":{"project":{"target":[{"column":3,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"},"source":{"scan":1}}}}},"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":2,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"=","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":"OR","operand":[{"operator":"IS NOT NULL","operand":[{"column":7,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":4,"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":8,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":1,"type":"BIGINT"},{"column":0,"type":"VARCHAR"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"scan":1}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"}],"source":{"scan":1}}}}}}}]}}}}}},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"column":1,"type":"VARCHAR"}],"source":{"scan":1}}}}}}}}}],"help":["LogicalProject(SAL=[$2])\n LogicalFilter(condition=[NOT(IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(SAL=[$2])\n LogicalFilter(condition=[OR(=($3, 0), IS NOT TRUE(OR(IS NOT NULL($7), <($4, $3))))])\n LogicalJoin(condition=[AND(=($0, $6), =($1, $8))], joinType=[left])\n LogicalJoin(condition=[=($1, $5)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(c=[$1], ck=[$1], NAME=[$0])\n LogicalAggregate(group=[{0}], c=[COUNT()])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], i=[true], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWhereNotInCorrelated2.json b/tests/benchmark/testWhereNotInCorrelated2.json deleted file mode 100644 index 3340594..0000000 --- a/tests/benchmark/testWhereNotInCorrelated2.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"NOT","operand":[{"operator":"IN","operand":[{"column":0,"type":"INTEGER"}],"query":{"project":{"target":[{"column":10,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":">","operand":[{"column":11,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":9,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"VARCHAR"},{"column":9,"type":"INTEGER"},{"column":14,"type":"INTEGER"}],"source":{"scan":0}}}}}}},"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NOT TRUE","operand":[{"operator":"OR","operand":[{"operator":"IS NOT NULL","operand":[{"column":13,"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"<","operand":[{"column":10,"type":"BIGINT"},{"column":9,"type":"BIGINT"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":12,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":14,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"left":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":11,"type":"VARCHAR"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":1,"type":"BIGINT"},{"column":1,"type":"BIGINT"},{"column":0,"type":"VARCHAR"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":1,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}},{"aggregate":{"function":[{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"VARCHAR"},{"column":1,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}]}}}}}},"right":{"project":{"target":[{"column":1,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"},{"column":0,"type":"VARCHAR"}],"source":{"filter":{"condition":{"operator":">","operand":[{"column":2,"type":"INTEGER"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"VARCHAR"},{"column":0,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[NOT(IN($0, {\nLogicalProject(EMPNO=[$1])\n LogicalFilter(condition=[AND(>($2, 2), =($cor0.ENAME, $0))])\n LogicalProject(ENAME=[$1], EMPNO=[$0], R=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(=($9, 0), IS NOT TRUE(OR(IS NOT NULL($13), <($10, $9))))])\n LogicalJoin(condition=[AND(=($0, $12), =($1, $14))], joinType=[left])\n LogicalJoin(condition=[=($1, $11)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(c=[$1], ck=[$1], ENAME=[$0])\n LogicalAggregate(group=[{0}], c=[COUNT()])\n LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[>($1, 2)])\n LogicalProject(ENAME=[$1], R=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$1], i=[true], ENAME=[$0])\n LogicalFilter(condition=[>($2, 2)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], R=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWhereOrSubQuery.json b/tests/benchmark/testWhereOrSubQuery.json deleted file mode 100644 index 84ef45c..0000000 --- a/tests/benchmark/testWhereOrSubQuery.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]},{"name":"DEPT","fields":["DEPTNO","NAME"],"types":["INTEGER","VARCHAR"],"nullable":[false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NOT","operand":[{"operator":"IN","operand":[{"column":0,"type":"INTEGER"}],"query":{"project":{"target":[{"column":9,"type":"INTEGER"}],"source":{"scan":1}}},"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"scan":0}}}}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":2,"type":"VARCHAR"},{"column":3,"type":"INTEGER"},{"column":4,"type":"TIMESTAMP"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":8,"type":"BOOLEAN"}],"source":{"filter":{"condition":{"operator":"OR","operand":[{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"operator":"4","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":10,"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"join":{"kind":"LEFT","condition":{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":9,"type":"INTEGER"}],"type":"BOOLEAN"},"left":{"scan":0},"right":{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"true","operand":[],"type":"BOOLEAN"}],"source":{"scan":1}}}}}}}}}],"help":["LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(=($5, 4), NOT(IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(=($5, 4), IS NULL($10))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], i=[true])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWithinDistinct.json b/tests/benchmark/testWithinDistinct.json deleted file mode 100644 index e569a1c..0000000 --- a/tests/benchmark/testWithinDistinct.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","SAL","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CAST","operand":[{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"operator":"=","operand":[{"column":6,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[SUM($1) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$2], SAL=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], $f1=[CAST($1):INTEGER NOT NULL], $f2=[$2])\n LogicalAggregate(group=[{0}], agg#0=[MIN($1) FILTER $3], agg#1=[$SUM0($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f3=[$3], $f6=[=($5, 1)], $f7=[AND(=($5, 0), $THROW_UNLESS(OR(<>($5, 0), =($3, $4)), 'more than one distinct value in agg UNIQUE_VALUE'))])\n LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}]], agg#0=[$SUM0($1)], agg#1=[MIN($1)], agg#2=[MAX($1)], agg#3=[GROUPING($0, $2)])\n LogicalProject(DEPTNO=[$2], SAL=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWithinDistinctCountDistinct.json b/tests/benchmark/testWithinDistinctCountDistinct.json deleted file mode 100644 index e16b234..0000000 --- a/tests/benchmark/testWithinDistinctCountDistinct.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[{"column":4,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":4,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":4,"type":"VARCHAR"}],"distinct":true,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":2,"type":"BIGINT"},{"column":2,"type":"BIGINT"},{"column":2,"type":"BIGINT"},{"column":3,"type":"BIGINT"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"VARCHAR"},{"operator":"=","operand":[{"column":6,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":6,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":6,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"operator":">","operand":[{"column":5,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":6,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"VARCHAR"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":6,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":5,"type":"VARCHAR"},{"operator":">","operand":[{"column":8,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"COUNT","operand":[{"column":3,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":5,"type":"VARCHAR"},{"operator":"=","operand":[{"column":7,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":7,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":7,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":7,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"VARCHAR"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"GROUPING","operand":[{"column":4,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"column":7,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":7,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"column":10,"type":"INTEGER"},{"column":6,"type":"VARCHAR"},{"operator":">","operand":[{"column":9,"type":"INTEGER"},{"operator":"1000","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], SS_C=[SUM($1) WITHIN DISTINCT ($2)], CDJ=[COUNT(DISTINCT $3)], CJ_J=[COUNT() WITHIN DISTINCT ($3)], CDJ_J=[COUNT(DISTINCT $3) WITHIN DISTINCT ($3)], CDJ_FILTERED=[COUNT(DISTINCT $3) FILTER $4])\n LogicalProject(DEPTNO=[$7], SAL=[$5], COMM=[$6], JOB=[$2], $f4=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], $f1=[$1], $f2=[$2], $f20=[$2], $f21=[$2], $f3=[$3])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[COUNT($2) FILTER $5])\n LogicalProject(DEPTNO=[$0], $f3=[$3], $f4=[$4], $f7=[=($6, 1)], $f8=[=($6, 2)], $f9=[AND(=($6, 2), >($5, 0))])\n LogicalAggregate(group=[{0, 2, 3}], groups=[[{0, 2}, {0, 3}]], agg#0=[MIN($1)], agg#1=[MIN($3) FILTER $4], agg#2=[COUNT() FILTER $4], agg#3=[GROUPING($0, $2, $3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], COMM=[$6], JOB=[$2], $f4=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWithinDistinctFilteredAggs.json b/tests/benchmark/testWithinDistinctFilteredAggs.json deleted file mode 100644 index 56b4e27..0000000 --- a/tests/benchmark/testWithinDistinctFilteredAggs.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":3,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"column":4,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":9,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":8,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":9,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":8,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":6,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"operator":">","operand":[{"column":9,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"VARCHAR"},{"column":9,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":4,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":10,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":10,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":10,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":10,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":9,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":10,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":8,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":10,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":9,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":3,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":8,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":8,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"GROUPING","operand":[{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":7,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":7,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"operator":">","operand":[{"column":10,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":6,"type":"VARCHAR"},{"column":10,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":5,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($1) FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/(CASE(=($4, 0), null:INTEGER, $3), $4)):INTEGER])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[$SUM0($2) FILTER $5], agg#3=[COUNT() FILTER $6])\n LogicalProject(DEPTNO=[$0], $f3=[$3], $f6=[$6], $f10=[AND(=($9, 2), >($5, 0), $THROW_UNLESS(OR(<>($9, 2), AND(IS NULL($3), IS NULL($4)), IS TRUE(=($3, $4))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f11=[AND(=($9, 2), >($5, 0))], $f12=[AND(=($9, 1), >($8, 0), $THROW_UNLESS(OR(<>($9, 1), AND(IS NULL($6), IS NULL($7)), IS TRUE(=($6, $7))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f13=[AND(=($9, 1), >($8, 0))])\n LogicalAggregate(group=[{0, 1, 3}], groups=[[{0, 1}, {0, 3}]], agg#0=[MIN($1) FILTER $2], agg#1=[MAX($1) FILTER $2], agg#2=[COUNT() FILTER $2], agg#3=[MIN($4) FILTER $5], agg#4=[MAX($4) FILTER $5], agg#5=[COUNT() FILTER $5], agg#6=[GROUPING($0, $1, $3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWithinDistinctFilteredAggsSameFilter.json b/tests/benchmark/testWithinDistinctFilteredAggsSameFilter.json deleted file mode 100644 index 07d7cd7..0000000 --- a/tests/benchmark/testWithinDistinctFilteredAggsSameFilter.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"column":3,"type":"VARCHAR"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"column":4,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":8,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":8,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":8,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":8,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":8,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":8,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":6,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":4,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"column":5,"type":"VARCHAR"},{"column":9,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":9,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"2","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"<>","operand":[{"column":9,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":8,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":7,"type":"INTEGER"},{"column":8,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":"=","operand":[{"column":9,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"column":3,"type":"VARCHAR"},{"column":7,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":8,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":8,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"column":7,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":3,"type":"VARCHAR"},{"column":7,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":11,"type":"INTEGER"},{"column":9,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":5,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"column":6,"type":"VARCHAR"},{"column":10,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($1) FILTER $2])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[LIKE($1, '%ok%')], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/(CASE(=($4, 0), null:INTEGER, $3), $4)):INTEGER])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[$SUM0($2) FILTER $5], agg#3=[COUNT() FILTER $6])\n LogicalProject(DEPTNO=[$0], $f3=[$3], $f6=[$6], $f9=[AND(=($8, 2), >($5, 0), $THROW_UNLESS(OR(<>($8, 2), AND(IS NULL($3), IS NULL($4)), IS TRUE(=($3, $4))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f10=[AND(=($8, 2), >($5, 0))], $f11=[AND(=($8, 1), >($5, 0), $THROW_UNLESS(OR(<>($8, 1), AND(IS NULL($6), IS NULL($7)), IS TRUE(=($6, $7))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f12=[AND(=($8, 1), >($5, 0))])\n LogicalAggregate(group=[{0, 1, 3}], groups=[[{0, 1}, {0, 3}]], agg#0=[MIN($1) FILTER $2], agg#1=[MAX($1) FILTER $2], agg#2=[COUNT() FILTER $2], agg#3=[MIN($4) FILTER $2], agg#4=[MAX($4) FILTER $2], agg#5=[GROUPING($0, $1, $3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[LIKE($1, '%ok%')], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWithinDistinctFilteredAggsUniformDistinctKeys.json b/tests/benchmark/testWithinDistinctFilteredAggsUniformDistinctKeys.json deleted file mode 100644 index 0fddbe3..0000000 --- a/tests/benchmark/testWithinDistinctFilteredAggsUniformDistinctKeys.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":3,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"column":4,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":7,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":7,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"operator":">","operand":[{"column":8,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":4,"type":"VARCHAR"},{"column":8,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"AND","operand":[{"operator":">","operand":[{"column":8,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"OR","operand":[{"operator":"AND","operand":[{"operator":"IS NULL","operand":[{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"IS NULL","operand":[{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"IS TRUE","operand":[{"operator":"=","operand":[{"column":6,"type":"INTEGER"},{"column":7,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":8,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":3,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"operator":">","operand":[{"column":9,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"VARCHAR"},{"column":9,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":4,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($3) FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/(CASE(=($4, 0), null:INTEGER, $3), $4)):INTEGER])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[$SUM0($2) FILTER $5], agg#3=[COUNT() FILTER $6])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f5=[$5], $f8=[AND(>($4, 0), $THROW_UNLESS(OR(AND(IS NULL($2), IS NULL($3)), IS TRUE(=($2, $3))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f9=[>($4, 0)], $f10=[AND(>($7, 0), $THROW_UNLESS(OR(AND(IS NULL($5), IS NULL($6)), IS TRUE(=($5, $6))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f11=[>($7, 0)])\n LogicalAggregate(group=[{0, 3}], agg#0=[MIN($1) FILTER $2], agg#1=[MAX($1) FILTER $2], agg#2=[COUNT() FILTER $2], agg#3=[MIN($4) FILTER $5], agg#4=[MAX($4) FILTER $5], agg#5=[COUNT() FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json b/tests/benchmark/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json deleted file mode 100644 index 0dc11ce..0000000 --- a/tests/benchmark/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["EMPNO","ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO","SLACKER"],"types":["INTEGER","VARCHAR","VARCHAR","INTEGER","TIMESTAMP","INTEGER","INTEGER","INTEGER","BOOLEAN"],"nullable":[false,false,false,true,false,false,false,false,false],"key":[[0]],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":3,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":2,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"operator":"CASE","operand":[{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"NULL","operand":[],"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"INTEGER"},{"column":4,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"operator":">","operand":[{"column":3,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":7,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":6,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":2,"type":"VARCHAR"},{"column":6,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":1,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":9,"type":"INTEGER"},{"column":7,"type":"INTEGER"},{"operator":">","operand":[{"column":8,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":4,"type":"VARCHAR"},{"column":8,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":3,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":">","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":">","operand":[{"column":6,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":8,"type":"INTEGER"},{"column":6,"type":"INTEGER"},{"operator":">","operand":[{"column":7,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":3,"type":"VARCHAR"},{"column":7,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":2,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"},{"operator":"MIN","operand":[{"column":7,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":6,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":10,"type":"INTEGER"},{"column":8,"type":"INTEGER"},{"operator":">","operand":[{"column":9,"type":"INTEGER"},{"operator":"10","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"column":5,"type":"VARCHAR"},{"column":9,"type":"INTEGER"},{"operator":"LIKE","operand":[{"column":4,"type":"VARCHAR"},{"operator":"_ISO-8859-1'%ok%'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($3) FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/(CASE(=($4, 0), null:INTEGER, $3), $4)):INTEGER])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $3], agg#2=[$SUM0($2) FILTER $4], agg#3=[COUNT() FILTER $4])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f4=[$4], $f6=[>($3, 0)], $f7=[>($5, 0)])\n LogicalAggregate(group=[{0, 3}], agg#0=[MIN($1) FILTER $2], agg#1=[COUNT() FILTER $2], agg#2=[MIN($4) FILTER $5], agg#3=[COUNT() FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWithinDistinctNoThrow.json b/tests/benchmark/testWithinDistinctNoThrow.json deleted file mode 100644 index 9bf3389..0000000 --- a/tests/benchmark/testWithinDistinctNoThrow.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","SAL","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER"],"nullable":[false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"operator":"CAST","operand":[{"column":1,"type":"INTEGER"}],"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":4,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":2,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":2,"type":"INTEGER"},{"column":4,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"1","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":5,"type":"BIGINT"},{"operator":"0","operand":[],"type":"INTEGER"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"GROUPING","operand":[{"column":3,"type":"INTEGER"},{"column":5,"type":"VARCHAR"}],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[SUM($1) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$2], SAL=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], $f1=[CAST($1):INTEGER NOT NULL], $f2=[$2])\n LogicalAggregate(group=[{0}], agg#0=[MIN($1) FILTER $3], agg#1=[$SUM0($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f3=[$3], $f5=[=($4, 1)], $f6=[=($4, 0)])\n LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}]], agg#0=[$SUM0($1)], agg#1=[MIN($1)], agg#2=[GROUPING($0, $2)])\n LogicalProject(DEPTNO=[$2], SAL=[$1], JOB=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWithinDistinctUniformDistinctKeys.json b/tests/benchmark/testWithinDistinctUniformDistinctKeys.json deleted file mode 100644 index fed9543..0000000 --- a/tests/benchmark/testWithinDistinctUniformDistinctKeys.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","SAL","COMM","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"operator":"$THROW_UNLESS","operand":[{"operator":"=","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"=","operand":[{"column":4,"type":"INTEGER"},{"column":5,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":5,"type":"INTEGER"},{"operator":"$THROW_UNLESS","operand":[{"operator":"=","operand":[{"column":3,"type":"INTEGER"},{"column":4,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"},{"operator":"$THROW_UNLESS","operand":[{"operator":"=","operand":[{"column":5,"type":"INTEGER"},{"column":6,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'","operand":[],"type":"CHAR"}],"type":"BOOLEAN"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MAX","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($2)], EXPR$2=[AVG($3) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$3], SAL=[$1], JOB=[$0], COMM=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[$SUM0($2) FILTER $4], agg#2=[COUNT()])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f4=[$4], $f6=[$THROW_UNLESS(=($2, $3), 'more than one distinct value in agg UNIQUE_VALUE')], $f7=[$THROW_UNLESS(=($4, $5), 'more than one distinct value in agg UNIQUE_VALUE')])\n LogicalAggregate(group=[{0, 2}], agg#0=[MIN($1)], agg#1=[MAX($1)], agg#2=[MIN($3)], agg#3=[MAX($3)])\n LogicalProject(DEPTNO=[$3], SAL=[$1], JOB=[$0], COMM=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/benchmark/testWithinDistinctUniformDistinctKeysNoThrow.json b/tests/benchmark/testWithinDistinctUniformDistinctKeysNoThrow.json deleted file mode 100644 index 85a27ec..0000000 --- a/tests/benchmark/testWithinDistinctUniformDistinctKeysNoThrow.json +++ /dev/null @@ -1 +0,0 @@ -{"schemas":[{"name":"EMP","fields":["JOB","SAL","COMM","DEPTNO"],"types":["VARCHAR","INTEGER","INTEGER","INTEGER"],"nullable":[false,false,false,false],"key":[],"foreign":[],"guaranteed":[]}],"queries":[{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"SUM","operand":[{"column":2,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"AVG","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}},{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"operator":"CAST","operand":[{"operator":"/","operand":[{"column":2,"type":"INTEGER"},{"column":3,"type":"BIGINT"}],"type":"BIGINT"}],"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"}],"source":{"distinct":{"correlate":[{"project":{"target":[{"column":0,"type":"INTEGER"},{"column":2,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":3,"type":"INTEGER"},{"column":1,"type":"INTEGER"},{"column":0,"type":"VARCHAR"},{"column":2,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":5,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":2,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":1,"type":"VARCHAR"},{"column":4,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":5,"type":"INTEGER"},{"column":3,"type":"INTEGER"},{"column":2,"type":"VARCHAR"},{"column":4,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}},{"aggregate":{"function":[{"operator":"$SUM0","operand":[{"column":3,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"$SUM0","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"COUNT","operand":[],"distinct":false,"ignoreNulls":false,"type":"BIGINT"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":0,"type":"INTEGER"},{"column":1,"type":"INTEGER"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"distinct":{"correlate":[{"project":{"target":[{"column":1,"type":"INTEGER"},{"column":3,"type":"VARCHAR"}],"source":{"project":{"target":[{"column":4,"type":"INTEGER"},{"column":2,"type":"INTEGER"},{"column":1,"type":"VARCHAR"},{"column":3,"type":"INTEGER"}],"source":{"scan":0}}}}},{"aggregate":{"function":[{"operator":"MIN","operand":[{"column":4,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"},{"operator":"MIN","operand":[{"column":6,"type":"INTEGER"}],"distinct":false,"ignoreNulls":false,"type":"INTEGER"}],"source":{"filter":{"condition":{"operator":"AND","operand":[{"operator":"=","operand":[{"column":1,"type":"INTEGER"},{"column":3,"type":"INTEGER"}],"type":"BOOLEAN"},{"operator":"=","operand":[{"column":2,"type":"VARCHAR"},{"column":5,"type":"VARCHAR"}],"type":"BOOLEAN"}],"type":"BOOLEAN"},"source":{"project":{"target":[{"column":6,"type":"INTEGER"},{"column":4,"type":"INTEGER"},{"column":3,"type":"VARCHAR"},{"column":5,"type":"INTEGER"}],"source":{"scan":0}}}}}}}]}}}}}}]}}}}],"help":["LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($2)], EXPR$2=[AVG($3) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$3], SAL=[$1], JOB=[$0], COMM=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n","LogicalProject(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($2)], agg#1=[$SUM0($3)], agg#2=[COUNT()])\n LogicalAggregate(group=[{0, 2}], agg#0=[MIN($1)], agg#1=[MIN($3)])\n LogicalProject(DEPTNO=[$3], SAL=[$1], JOB=[$0], COMM=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n"]} \ No newline at end of file diff --git a/tests/calcite/testAddRedundantSemiJoinRule.json b/tests/calcite/testAddRedundantSemiJoinRule.json new file mode 100644 index 0000000..744b2b9 --- /dev/null +++ b/tests/calcite/testAddRedundantSemiJoinRule.json @@ -0,0 +1,98 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateCaseToFilter.json b/tests/calcite/testAggregateCaseToFilter.json new file mode 100644 index 0000000..fe3aeb4 --- /dev/null +++ b/tests/calcite/testAggregateCaseToFilter.json @@ -0,0 +1,993 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'CLERK'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "40", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'x'", + "operand" : [ ], + "type" : "CHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "CHAR" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "45", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "50", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "DECIMAL" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "70", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 5, + "type" : "CHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 8, + "type" : "DECIMAL" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "DECIMAL" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'CLERK'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "40", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'x'", + "operand" : [ ], + "type" : "CHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "CHAR" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "45", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "50", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "DECIMAL" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "70", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + } ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "BIGINT" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "DECIMAL" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "DECIMAL" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'CLERK'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "40", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "45", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "50", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "70", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 1, + "type" : "DECIMAL" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "DECIMAL" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 14, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "DECIMAL" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'CLERK'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "40", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "45", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "50", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "70", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)], COUNT_DISTINCT_CLERK=[COUNT(DISTINCT $1)], SUM_SAL_D10=[SUM($2)], SUM_SAL_D20=[SUM($3)], COUNT_D30=[SUM($4)], COUNT_D40=[COUNT($5)], COUNT_D45=[SUM($6)], COUNT_D50=[SUM($7)], SUM_NULL_D60=[SUM($8)], SUM_NULL_D70=[SUM($9)], COUNT_D20=[COUNT($10)])\n LogicalProject(SAL=[$5], $f1=[CASE(=($2, 'CLERK'), $7, null:INTEGER)], $f2=[CASE(=($7, 10), $5, null:INTEGER)], $f3=[CASE(=($7, 20), $5, 0)], $f4=[CASE(=($7, 30), 1, 0)], $f5=[CASE(=($7, 40), 'x', null:CHAR(1))], $f6=[CASE(=($7, 45), 1, null:INTEGER)], $f7=[CASE(=($7, 50), 1, null:INTEGER)], $f8=[null:DECIMAL(19, 9)], $f9=[CASE(=($7, 70), null:INTEGER, 1)], $f10=[CASE(=($7, 20), 1, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SUM_SAL=[$0], COUNT_DISTINCT_CLERK=[$1], SUM_SAL_D10=[$2], SUM_SAL_D20=[$3], COUNT_D30=[CAST($4):INTEGER], COUNT_D40=[$5], COUNT_D45=[$6], COUNT_D50=[$7], SUM_NULL_D60=[$8], SUM_NULL_D70=[$9], COUNT_D20=[$10])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)], COUNT_DISTINCT_CLERK=[COUNT(DISTINCT $2) FILTER $3], SUM_SAL_D10=[SUM($4) FILTER $5], SUM_SAL_D20=[SUM($6) FILTER $7], COUNT_D30=[COUNT() FILTER $8], COUNT_D40=[COUNT() FILTER $9], COUNT_D45=[SUM($10) FILTER $11], COUNT_D50=[SUM($12) FILTER $13], SUM_NULL_D60=[SUM($1)], SUM_NULL_D70=[SUM($14) FILTER $15], COUNT_D20=[COUNT() FILTER $16])\n LogicalProject(SAL=[$5], $f8=[null:DECIMAL(19, 9)], DEPTNO=[$7], $f12=[=($2, 'CLERK')], SAL0=[$5], $f14=[=($7, 10)], SAL1=[$5], $f16=[=($7, 20)], $f17=[=($7, 30)], $f18=[=($7, 40)], $f19=[1], $f20=[=($7, 45)], $f21=[1], $f22=[=($7, 50)], $f23=[1], $f24=[<>($7, 70)], $f25=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateConstantKeyRule.json b/tests/calcite/testAggregateConstantKeyRule.json new file mode 100644 index 0000000..fb2b623 --- /dev/null +++ b/tests/calcite/testAggregateConstantKeyRule.json @@ -0,0 +1,250 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "BIGINT" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalProject(C=[$2])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(C=[$2])\n LogicalProject(DEPTNO=[10], SAL=[$0], C=[$1])\n LogicalAggregate(group=[{0}], C=[COUNT()])\n LogicalProject(SAL=[$5])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateConstantKeyRule3.json b/tests/calcite/testAggregateConstantKeyRule3.json new file mode 100644 index 0000000..a1a3bad --- /dev/null +++ b/tests/calcite/testAggregateConstantKeyRule3.json @@ -0,0 +1,326 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'Clerk'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'Clerk'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "_ISO-8859-1'Clerk'", + "operand" : [ ], + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'Clerk'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'Clerk'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(JOB=[$1])\n LogicalFilter(condition=[>($2, 3)])\n LogicalAggregate(group=[{0, 1}], agg#0=[COUNT()])\n LogicalProject(MGR=[$3], JOB=[$2])\n LogicalFilter(condition=[AND(IS NULL($3), =($2, 'Clerk'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(JOB=[$1])\n LogicalFilter(condition=[>($2, 3)])\n LogicalProject(MGR=[$0], JOB=['Clerk':VARCHAR(10)], $f2=[$1])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalProject(MGR=[$3])\n LogicalFilter(condition=[AND(IS NULL($3), =($2, 'Clerk'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateDynamicFunction.json b/tests/calcite/testAggregateDynamicFunction.json new file mode 100644 index 0000000..8832919 --- /dev/null +++ b/tests/calcite/testAggregateDynamicFunction.json @@ -0,0 +1,326 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "TIMESTAMP" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "TIMESTAMP" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "operator" : "CURRENT_TIMESTAMP", + "operand" : [ ], + "type" : "TIMESTAMP" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "TIMESTAMP" + }, { + "column" : 3, + "type" : "TIMESTAMP" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "operator" : "CURRENT_TIMESTAMP", + "operand" : [ ], + "type" : "TIMESTAMP" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "TIMESTAMP" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CURRENT_TIMESTAMP", + "operand" : [ ], + "type" : "TIMESTAMP" + }, { + "column" : 1, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "operator" : "CURRENT_TIMESTAMP", + "operand" : [ ], + "type" : "TIMESTAMP" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "operator" : "CURRENT_TIMESTAMP", + "operand" : [ ], + "type" : "TIMESTAMP" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(HIREDATE=[$1])\n LogicalFilter(condition=[>($2, 3)])\n LogicalAggregate(group=[{0, 1}], agg#0=[COUNT()])\n LogicalProject(MGR=[$3], HIREDATE=[$4])\n LogicalFilter(condition=[AND(IS NULL($3), =($4, CURRENT_TIMESTAMP))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(HIREDATE=[$1])\n LogicalFilter(condition=[>($2, 3)])\n LogicalProject(MGR=[$0], HIREDATE=[CURRENT_TIMESTAMP], $f2=[$1])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalProject(MGR=[$3])\n LogicalFilter(condition=[AND(IS NULL($3), =($4, CURRENT_TIMESTAMP))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateExtractProjectRule.json b/tests/calcite/testAggregateExtractProjectRule.json new file mode 100644 index 0000000..202cae2 --- /dev/null +++ b/tests/calcite/testAggregateExtractProjectRule.json @@ -0,0 +1,100 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateExtractProjectRuleWithGroupingSets.json b/tests/calcite/testAggregateExtractProjectRuleWithGroupingSets.json new file mode 100644 index 0000000..5139778 --- /dev/null +++ b/tests/calcite/testAggregateExtractProjectRuleWithGroupingSets.json @@ -0,0 +1,164 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 7}], groups=[[{0, 7}, {0}, {7}]], EXPR$2=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}, {2}]], EXPR$2=[SUM($1)])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateExtractProjectRuleWithGroupingSets2.json b/tests/calcite/testAggregateExtractProjectRuleWithGroupingSets2.json new file mode 100644 index 0000000..f4fb535 --- /dev/null +++ b/tests/calcite/testAggregateExtractProjectRuleWithGroupingSets2.json @@ -0,0 +1,158 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 7}], groups=[[{0, 7}, {0}, {7}]], EXPR$2=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {1}]], EXPR$2=[SUM($0)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateGroupingSetsProjectMerge.json b/tests/calcite/testAggregateGroupingSetsProjectMerge.json new file mode 100644 index 0000000..b953610 --- /dev/null +++ b/tests/calcite/testAggregateGroupingSetsProjectMerge.json @@ -0,0 +1,206 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$1=[SUM($2)])\n LogicalProject(X=[$7], Y=[$0], Z=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\n LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 7}], groups=[[{0, 7}, {7}, {}]], EXPR$1=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove1.json b/tests/calcite/testAggregateJoinRemove1.json new file mode 100644 index 0000000..d9574ca --- /dev/null +++ b/tests/calcite/testAggregateJoinRemove1.json @@ -0,0 +1,153 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove10.json b/tests/calcite/testAggregateJoinRemove10.json new file mode 100644 index 0000000..2eb8511 --- /dev/null +++ b/tests/calcite/testAggregateJoinRemove10.json @@ -0,0 +1,303 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 13, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 13, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1, $2)])\n LogicalProject(DEPTNO=[$7], NAME=[$10], NAME0=[$12])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}], EXPR$1=[COUNT(DISTINCT $10, $12)])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove11.json b/tests/calcite/testAggregateJoinRemove11.json new file mode 100644 index 0000000..0f1cabd --- /dev/null +++ b/tests/calcite/testAggregateJoinRemove11.json @@ -0,0 +1,177 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}], EXPR$1=[COUNT(DISTINCT $8)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove2.json b/tests/calcite/testAggregateJoinRemove2.json new file mode 100644 index 0000000..73913d3 --- /dev/null +++ b/tests/calcite/testAggregateJoinRemove2.json @@ -0,0 +1,177 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}], EXPR$1=[COUNT(DISTINCT $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove3.json b/tests/calcite/testAggregateJoinRemove3.json new file mode 100644 index 0000000..31916c0 --- /dev/null +++ b/tests/calcite/testAggregateJoinRemove3.json @@ -0,0 +1,215 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 11, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}], EXPR$1=[COUNT(DISTINCT $10)])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove4.json b/tests/calcite/testAggregateJoinRemove4.json new file mode 100644 index 0000000..feab8b1 --- /dev/null +++ b/tests/calcite/testAggregateJoinRemove4.json @@ -0,0 +1,123 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$9])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove5.json b/tests/calcite/testAggregateJoinRemove5.json new file mode 100644 index 0000000..b4f4836 --- /dev/null +++ b/tests/calcite/testAggregateJoinRemove5.json @@ -0,0 +1,177 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove6.json b/tests/calcite/testAggregateJoinRemove6.json new file mode 100644 index 0000000..ed48480 --- /dev/null +++ b/tests/calcite/testAggregateJoinRemove6.json @@ -0,0 +1,215 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$9], JOB=[$2])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{9}], EXPR$1=[COUNT(DISTINCT $2)])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove7.json b/tests/calcite/testAggregateJoinRemove7.json new file mode 100644 index 0000000..8b6ba0d --- /dev/null +++ b/tests/calcite/testAggregateJoinRemove7.json @@ -0,0 +1,229 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove8.json b/tests/calcite/testAggregateJoinRemove8.json new file mode 100644 index 0000000..34f01c2 --- /dev/null +++ b/tests/calcite/testAggregateJoinRemove8.json @@ -0,0 +1,253 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 11, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], NAME0=[$12])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}], EXPR$1=[COUNT(DISTINCT $10)])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove9.json b/tests/calcite/testAggregateJoinRemove9.json new file mode 100644 index 0000000..6765b33 --- /dev/null +++ b/tests/calcite/testAggregateJoinRemove9.json @@ -0,0 +1,261 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 14, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], NAME=[$12])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7, 10}])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateMerge1.json b/tests/calcite/testAggregateMerge1.json new file mode 100644 index 0000000..b7488b7 --- /dev/null +++ b/tests/calcite/testAggregateMerge1.json @@ -0,0 +1,365 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 7, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{1}], EXPR$1=[MIN($4)], Z=[MAX($3)], EXPR$3=[SUM($6)], N=[SUM($5)], SAL=[SUM($2)])\n LogicalAggregate(group=[{1, 7}], X=[SUM($5)], Z=[MAX($5)], Y=[MIN($5)], M=[COUNT()], R=[COUNT($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{7}], EXPR$1=[MIN($5)], Z=[MAX($5)], EXPR$3=[COUNT($3)], N=[COUNT()], SAL=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateMerge2.json b/tests/calcite/testAggregateMerge2.json new file mode 100644 index 0000000..75e6723 --- /dev/null +++ b/tests/calcite/testAggregateMerge2.json @@ -0,0 +1,352 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$2=[$2], EXPR$3=[$3])\n LogicalAggregate(group=[{0, 2}], groups=[[{0}, {2}]], EXPR$2=[SUM($3)], EXPR$3=[SUM($4)])\n LogicalAggregate(group=[{0, 1, 7}], X=[SUM($5)], Y=[COUNT($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$2=[$2], EXPR$3=[$3])\n LogicalAggregate(group=[{0, 7}], groups=[[{0}, {7}]], EXPR$2=[SUM($5)], EXPR$3=[COUNT($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateMerge8.json b/tests/calcite/testAggregateMerge8.json new file mode 100644 index 0000000..73a23e4 --- /dev/null +++ b/tests/calcite/testAggregateMerge8.json @@ -0,0 +1,188 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], X=[SUM($0)], Z=[MIN($1)])\n LogicalAggregate(group=[{}], X=[SUM($5)], Y=[MIN($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], X=[SUM($5)], Z=[MIN($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateMergeSum0.json b/tests/calcite/testAggregateMergeSum0.json new file mode 100644 index 0000000..3fbb854 --- /dev/null +++ b/tests/calcite/testAggregateMergeSum0.json @@ -0,0 +1,195 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], agg#0=[$SUM0($2)])\n LogicalAggregate(group=[{3, 7}], COUNT_COMM=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateProjectMerge.json b/tests/calcite/testAggregateProjectMerge.json new file mode 100644 index 0000000..fee5108 --- /dev/null +++ b/tests/calcite/testAggregateProjectMerge.json @@ -0,0 +1,206 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM($2)])\n LogicalProject(X=[$7], Y=[$0], Z=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\n LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 7}], EXPR$1=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateProjectPullUpConstants.json b/tests/calcite/testAggregateProjectPullUpConstants.json new file mode 100644 index 0000000..ceeb301 --- /dev/null +++ b/tests/calcite/testAggregateProjectPullUpConstants.json @@ -0,0 +1,281 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1, 2}], S=[SUM($2)])\n LogicalProject(JOB=[$2], EMPNO=[$0], SAL=[$5])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(JOB=[$0], EMPNO=[10], SAL=[$1], S=[$2])\n LogicalAggregate(group=[{0, 1}], S=[SUM($1)])\n LogicalProject(JOB=[$2], SAL=[$5])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateProjectPullUpConstants2.json b/tests/calcite/testAggregateProjectPullUpConstants2.json new file mode 100644 index 0000000..5e951aa --- /dev/null +++ b/tests/calcite/testAggregateProjectPullUpConstants2.json @@ -0,0 +1,181 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'John'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'John'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "operator" : "_ISO-8859-1'John'", + "operand" : [ ], + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'John'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'John'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{1, 5}])\n LogicalFilter(condition=[=($1, 'John')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(ENAME=['John':VARCHAR(20)], SAL=[$0])\n LogicalAggregate(group=[{5}])\n LogicalFilter(condition=[=($1, 'John')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateRemove1.json b/tests/calcite/testAggregateRemove1.json new file mode 100644 index 0000000..9cb4ee0 --- /dev/null +++ b/tests/calcite/testAggregateRemove1.json @@ -0,0 +1,202 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "BIT_AND", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "BIT_OR", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "BIGINT" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], EXPR$1=[$2], EXPR$2=[$3], EXPR$3=[$4], EXPR$4=[$5], EXPR$5=[$6], EXPR$6=[$7])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM($2)], EXPR$2=[MIN($2)], EXPR$3=[MAX($2)], EXPR$4=[BIT_AND($2)], EXPR$5=[BIT_OR($2)], EXPR$6=[COUNT(DISTINCT $2)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], EXPR$1=[$5], EXPR$2=[$5], EXPR$3=[$5], EXPR$4=[$5], EXPR$5=[$5], EXPR$6=[1:BIGINT])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateRemove2.json b/tests/calcite/testAggregateRemove2.json new file mode 100644 index 0000000..16e1f3d --- /dev/null +++ b/tests/calcite/testAggregateRemove2.json @@ -0,0 +1,100 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateRemove3.json b/tests/calcite/testAggregateRemove3.json new file mode 100644 index 0000000..057e230 --- /dev/null +++ b/tests/calcite/testAggregateRemove3.json @@ -0,0 +1,142 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT($2)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], EXPR$1=[CASE(IS NOT NULL($3), 1:BIGINT, 0:BIGINT)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateRemove7.json b/tests/calcite/testAggregateRemove7.json new file mode 100644 index 0000000..5cdf791 --- /dev/null +++ b/tests/calcite/testAggregateRemove7.json @@ -0,0 +1,408 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(MGR=[$0], SUM_SAL=[$2])\n LogicalFilter(condition=[=($1, 100)])\n LogicalAggregate(group=[{0, 1}], SUM_SAL=[SUM($2)])\n LogicalProject(MGR=[$3], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(MGR=[$0], SUM_SAL=[$2])\n LogicalFilter(condition=[=($1, 100)])\n LogicalAggregate(group=[{0, 1}], SUM_SAL=[SUM($2)])\n LogicalProject(MGR=[$3], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateUnionTransposeWithOneInputUnique.json b/tests/calcite/testAggregateUnionTransposeWithOneInputUnique.json new file mode 100644 index 0000000..620bff7 --- /dev/null +++ b/tests/calcite/testAggregateUnionTransposeWithOneInputUnique.json @@ -0,0 +1,836 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], T=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], T=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(DEPTNO=[$7], T=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], T=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json b/tests/calcite/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json new file mode 100644 index 0000000..3982c58 --- /dev/null +++ b/tests/calcite/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json @@ -0,0 +1,720 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$1], T2=[$0])\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT($0)])\n LogicalUnion(all=[true])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1], T2=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT($0)])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT($0)])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAll.json b/tests/calcite/testAll.json new file mode 100644 index 0000000..4051f7a --- /dev/null +++ b/tests/calcite/testAll.json @@ -0,0 +1,367 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "NOT", + "operand" : [ { + "operator" : "<= SOME", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + }, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "NOT", + "operand" : [ { + "operator" : "CAST", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "<=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "column" : 11, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT TRUE", + "operand" : [ { + "operator" : "<=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "<=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT TRUE", + "operand" : [ { + "operator" : "<=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<=", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "column" : 11, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 1, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[NOT(<= SOME($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n}))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[NOT(CAST(OR(AND(IS TRUE(<=($0, $9)), <>($10, 0)), AND(>($10, $11), null, <>($10, 0), IS NOT TRUE(<=($0, $9))), AND(<=($0, $9), <>($10, 0), IS NOT TRUE(<=($0, $9)), <=($10, $11)))):BOOLEAN NOT NULL)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(m=[$0], c=[$1], d=[$1])\n LogicalAggregate(group=[{}], m=[MAX($0)], c=[COUNT()])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAlreadyFalseEliminatesFilter.json b/tests/calcite/testAlreadyFalseEliminatesFilter.json new file mode 100644 index 0000000..4adf54f --- /dev/null +++ b/tests/calcite/testAlreadyFalseEliminatesFilter.json @@ -0,0 +1,54 @@ +{ + "schemas" : [ ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalFilter(condition=[false])\n LogicalValues(tuples=[[{ 1, 2 }]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAntiJoinProjectTranspose.json b/tests/calcite/testAntiJoinProjectTranspose.json new file mode 100644 index 0000000..93dfc54 --- /dev/null +++ b/tests/calcite/testAntiJoinProjectTranspose.json @@ -0,0 +1,236 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "ANTI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "*", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "TINYINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "*", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "TINYINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "ANTI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "*", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "TINYINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "*", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "TINYINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[anti])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[anti])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalProject($f0=[$0])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAnyInProjectNonNullable.json b/tests/calcite/testAnyInProjectNonNullable.json new file mode 100644 index 0000000..373d1da --- /dev/null +++ b/tests/calcite/testAnyInProjectNonNullable.json @@ -0,0 +1,269 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "> SOME", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + }, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT TRUE", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT TRUE", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 1, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(NAME=[$1], EXPR$1=[> SOME($0, {\nLogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$1], EXPR$1=[CAST(OR(AND(IS TRUE(>($0, $2)), <>($3, 0)), AND(>($3, $4), null, <>($3, 0), IS NOT TRUE(>($0, $2))), AND(>($0, $2), <>($3, 0), IS NOT TRUE(>($0, $2)), <=($3, $4)))):BOOLEAN NOT NULL])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(m=[$0], c=[$1], d=[$1])\n LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testAnyInProjectNullable.json b/tests/calcite/testAnyInProjectNullable.json new file mode 100644 index 0000000..6a33e15 --- /dev/null +++ b/tests/calcite/testAnyInProjectNullable.json @@ -0,0 +1,282 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "IN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + }, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 5, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 5, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], EXPR$1=[IN($1, {\nLogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[OR(AND(IS NOT NULL($5), <>($2, 0)), AND(<($3, $2), null, <>($2, 0), IS NULL($5)))])\n LogicalJoin(condition=[=($1, $4)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(MGR=[$3], i=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testBitAndReuseDistinctAttrWithMixedOptionality.json b/tests/calcite/testBitAndReuseDistinctAttrWithMixedOptionality.json new file mode 100644 index 0000000..0b6734d --- /dev/null +++ b/tests/calcite/testBitAndReuseDistinctAttrWithMixedOptionality.json @@ -0,0 +1,244 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "BIT_AND", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "BIT_AND", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[BIT_AND($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT($0)], EXPR$2=[BIT_AND($0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testBitOrReuseDistinctAttrWithMixedOptionality.json b/tests/calcite/testBitOrReuseDistinctAttrWithMixedOptionality.json new file mode 100644 index 0000000..ca0475d --- /dev/null +++ b/tests/calcite/testBitOrReuseDistinctAttrWithMixedOptionality.json @@ -0,0 +1,244 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "BIT_OR", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "BIT_OR", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[BIT_OR($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT($0)], EXPR$2=[BIT_OR($0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testCasePushIsAlwaysWorking.json b/tests/calcite/testCasePushIsAlwaysWorking.json new file mode 100644 index 0000000..08d5b0a --- /dev/null +++ b/tests/calcite/testCasePushIsAlwaysWorking.json @@ -0,0 +1,112 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=(CASE(>($5, 1000), $0, $5), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(AND(>($5, 1000), =($0, 1)), =($5, 1))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testCastInAggregateExpandDistinctAggregatesRule.json b/tests/calcite/testCastInAggregateExpandDistinctAggregatesRule.json new file mode 100644 index 0000000..1daa893 --- /dev/null +++ b/tests/calcite/testCastInAggregateExpandDistinctAggregatesRule.json @@ -0,0 +1,830 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "GROUPING", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "GROUPING", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "BIGINT" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 5, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM(DISTINCT $1)], EXPR$2=[SUM(DISTINCT $2)])\n LogicalAggregate(group=[{0}], CN=[COUNT()], SM=[SUM($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[CAST($1):BIGINT NOT NULL], EXPR$2=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) FILTER $3], EXPR$2=[SUM($2) FILTER $4])\n LogicalProject(NAME=[$0], CN=[$1], SM=[$2], $g_1=[=($3, 1)], $g_2=[=($3, 2)])\n LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1}, {0, 2}]], $g=[GROUPING($0, $1, $2)])\n LogicalAggregate(group=[{0}], CN=[COUNT()], SM=[SUM($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testCastInAggregateReduceFunctions.json b/tests/calcite/testCastInAggregateReduceFunctions.json new file mode 100644 index 0000000..2b77b87 --- /dev/null +++ b/tests/calcite/testCastInAggregateReduceFunctions.json @@ -0,0 +1,479 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "STDDEV_POP", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "AVG", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "STDDEV_SAMP", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "VAR_POP", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "VAR_SAMP", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "POWER", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "operator" : "-", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "/", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "BIGINT" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + }, { + "operator" : "0.5", + "operand" : [ ], + "type" : "DECIMAL" + } ], + "type" : "DOUBLE" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "POWER", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "operator" : "-", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "/", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "BIGINT" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "BIGINT" + }, { + "operator" : "-", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "BIGINT" + }, { + "operator" : "0.5", + "operand" : [ ], + "type" : "DECIMAL" + } ], + "type" : "DOUBLE" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "operator" : "-", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "/", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "BIGINT" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "operator" : "-", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "/", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "BIGINT" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "BIGINT" + }, { + "operator" : "-", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "$SUM0", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[STDDEV_SAMP($1)], EXPR$4=[VAR_POP($1)], EXPR$5=[VAR_SAMP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[CAST(POWER(/(-($1, /(*($2, $2), $3)), $3), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[CAST(POWER(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1))), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$4=[CAST(/(-($1, /(*($2, $2), $3)), $3)):INTEGER NOT NULL], EXPR$5=[CAST(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1)))):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($2)], agg#1=[$SUM0($1)], agg#2=[COUNT()])\n LogicalProject(NAME=[$0], DEPTNO=[$1], $f2=[*($1, $1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testCustomColumnResolvingInCorrelatedSubQuery.json b/tests/calcite/testCustomColumnResolvingInCorrelatedSubQuery.json new file mode 100644 index 0000000..b497057 --- /dev/null +++ b/tests/calcite/testCustomColumnResolvingInCorrelatedSubQuery.json @@ -0,0 +1,310 @@ +{ + "schemas" : [ { + "name" : "T", + "fields" : [ "\"K0\"", "\"C1\"", "\"F1\".\"A0\"", "\"F2\".\"A0\"", "\"F0\".\"C0\"", "\"F1\".\"C0\"", "\"F0\".\"C1\"", "\"F1\".\"C2\"", "\"F2\".\"C3\"" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "BOOLEAN", "INTEGER", "INTEGER", "INTEGER", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BOOLEAN" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "operator" : "$SCALAR_QUERY", + "operand" : [ ], + "query" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 14, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 14, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BOOLEAN" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BOOLEAN" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "correlate" : [ { + "scan" : 0 + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 14, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 14, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[=($4, $SCALAR_QUERY({\nLogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(\"F1\".\"C0\"=[$5])\n LogicalFilter(condition=[=($cor0.\"K0\", $0)])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n", "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[=($4, $9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{0}])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n LogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(\"F1\".\"C0\"=[$5])\n LogicalFilter(condition=[=($cor0.\"K0\", $0)])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testCustomColumnResolvingInCorrelatedSubQuery2.json b/tests/calcite/testCustomColumnResolvingInCorrelatedSubQuery2.json new file mode 100644 index 0000000..446b909 --- /dev/null +++ b/tests/calcite/testCustomColumnResolvingInCorrelatedSubQuery2.json @@ -0,0 +1,253 @@ +{ + "schemas" : [ { + "name" : "T", + "fields" : [ "\"K0\"", "\"C1\"", "\"F1\".\"A0\"", "\"F2\".\"A0\"", "\"F0\".\"C0\"", "\"F1\".\"C0\"", "\"F0\".\"C1\"", "\"F1\".\"C2\"", "\"F2\".\"C3\"" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "BOOLEAN", "INTEGER", "INTEGER", "INTEGER", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BOOLEAN" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 14, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BOOLEAN" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BOOLEAN" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "correlate" : [ { + "scan" : 0 + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 14, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 15, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[IN($4, {\nLogicalProject(C0=[$5])\n LogicalFilter(condition=[=($cor0.\"F1\".\"C2\", $7)])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n", "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[=($4, $9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n LogicalAggregate(group=[{0}])\n LogicalProject(C0=[$5])\n LogicalFilter(condition=[=($cor0.\"F1\".\"C2\", $7)])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testCustomColumnResolvingInNonCorrelatedSubQuery.json b/tests/calcite/testCustomColumnResolvingInNonCorrelatedSubQuery.json new file mode 100644 index 0000000..9e24a8f --- /dev/null +++ b/tests/calcite/testCustomColumnResolvingInNonCorrelatedSubQuery.json @@ -0,0 +1,208 @@ +{ + "schemas" : [ { + "name" : "T", + "fields" : [ "\"K0\"", "\"C1\"", "\"F1\".\"A0\"", "\"F2\".\"A0\"", "\"F0\".\"C0\"", "\"F1\".\"C0\"", "\"F0\".\"C1\"", "\"F1\".\"C2\"", "\"F2\".\"C3\"" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "BOOLEAN", "INTEGER", "INTEGER", "INTEGER", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BOOLEAN" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 14, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BOOLEAN" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BOOLEAN" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[IN($4, {\nLogicalProject(C0=[$5])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n})])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n", "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalJoin(condition=[=($4, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n LogicalAggregate(group=[{0}])\n LogicalProject(C0=[$5])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDecorrelateAggWithConstantGroupKey.json b/tests/calcite/testDecorrelateAggWithConstantGroupKey.json new file mode 100644 index 0000000..5853ba3 --- /dev/null +++ b/tests/calcite/testDecorrelateAggWithConstantGroupKey.json @@ -0,0 +1,581 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "correlate" : [ { + "scan" : 0 + }, { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "CHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "operator" : "_ISO-8859-1'abc'", + "operand" : [ ], + "type" : "CHAR" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 13, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "CHAR" + }, { + "column" : 12, + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 13, + "type" : "INTEGER" + }, { + "operator" : "_ISO-8859-1'abc'", + "operand" : [ ], + "type" : "CHAR" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 12, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "CHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 12, + "type" : "INTEGER" + }, { + "operator" : "_ISO-8859-1'abc'", + "operand" : [ ], + "type" : "CHAR" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 14, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 11, + "type" : "CHAR" + }, { + "column" : 13, + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 14, + "type" : "INTEGER" + }, { + "operator" : "_ISO-8859-1'abc'", + "operand" : [ ], + "type" : "CHAR" + }, { + "column" : 13, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "INTEGER" + }, { + "column" : 19, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } + } + } ] + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{3, 5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($cor0.SAL, $0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(EXPR$0=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$0=[MAX($2)])\n LogicalProject(DEPTNO=[$2], $f1=['abc'], SAL=[$1])\n LogicalFilter(condition=[=($cor0.MGR, $0)])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[AND(=($3, $10), =($5, $9))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[$2], EMPNO=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$0=[MAX($2)])\n LogicalProject(DEPTNO=[$7], EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDecorrelateExists.json b/tests/calcite/testDecorrelateExists.json new file mode 100644 index 0000000..f9b8cb0 --- /dev/null +++ b/tests/calcite/testDecorrelateExists.json @@ -0,0 +1,192 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "EXISTS", + "operand" : [ ], + "query" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[EXISTS({\nLogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], $f1=[true])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDecorrelateTwoExists.json b/tests/calcite/testDecorrelateTwoExists.json new file mode 100644 index 0000000..78bba5f --- /dev/null +++ b/tests/calcite/testDecorrelateTwoExists.json @@ -0,0 +1,366 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "EXISTS", + "operand" : [ ], + "query" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "type" : "BOOLEAN" + }, { + "operator" : "NOT", + "operand" : [ { + "operator" : "EXISTS", + "operand" : [ ], + "query" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 14, + "type" : "INTEGER" + }, { + "operator" : "34", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NULL", + "operand" : [ { + "column" : 12, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "34", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "34", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(EXISTS({\nLogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), NOT(EXISTS({\nLogicalFilter(condition=[AND(=($2, $cor0.JOB), =($5, 34))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NULL($12)])\n LogicalJoin(condition=[=($2, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], $f1=[true])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$0], $f1=[true])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$2])\n LogicalFilter(condition=[=($5, 34)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDecorrelateTwoIn.json b/tests/calcite/testDecorrelateTwoIn.json new file mode 100644 index 0000000..6190086 --- /dev/null +++ b/tests/calcite/testDecorrelateTwoIn.json @@ -0,0 +1,202 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "IN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + }, + "type" : "BOOLEAN" + }, { + "operator" : "IN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[AND(IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n}), IN($0, {\nLogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=($cor0.ENAME, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalJoin(condition=[AND(=($1, $12), =($0, $11))], joinType=[inner])\n LogicalJoin(condition=[AND(=($2, $10), =($0, $9))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDecorrelateUncorrelatedInAndCorrelatedExists.json b/tests/calcite/testDecorrelateUncorrelatedInAndCorrelatedExists.json new file mode 100644 index 0000000..00bca7e --- /dev/null +++ b/tests/calcite/testDecorrelateUncorrelatedInAndCorrelatedExists.json @@ -0,0 +1,335 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "IN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 14, + "type" : "INTEGER" + }, { + "operator" : "34", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "type" : "BOOLEAN" + }, { + "operator" : "EXISTS", + "operand" : [ ], + "query" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "34", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "34", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(IN($2, {\nLogicalProject(JOB=[$2])\n LogicalFilter(condition=[=($5, 34)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), EXISTS({\nLogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $10)], joinType=[inner])\n LogicalJoin(condition=[=($2, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$2])\n LogicalFilter(condition=[=($5, 34)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], $f1=[true])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDigestOfApproximateDistinctAggregateCall.json b/tests/calcite/testDigestOfApproximateDistinctAggregateCall.json new file mode 100644 index 0000000..eb01a19 --- /dev/null +++ b/tests/calcite/testDigestOfApproximateDistinctAggregateCall.json @@ -0,0 +1,278 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BIGINT" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BIGINT" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } ] + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], EXPR$1=[$1])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT(APPROXIMATE DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$1])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{7}], EXPR$1=[COUNT(DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{7}], EXPR$1=[COUNT(APPROXIMATE DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctCount1.json b/tests/calcite/testDistinctCount1.json new file mode 100644 index 0000000..24c25a2 --- /dev/null +++ b/tests/calcite/testDistinctCount1.json @@ -0,0 +1,234 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{1}], EXPR$1=[COUNT($0)])\n LogicalAggregate(group=[{1, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctCount2.json b/tests/calcite/testDistinctCount2.json new file mode 100644 index 0000000..24491ed --- /dev/null +++ b/tests/calcite/testDistinctCount2.json @@ -0,0 +1,424 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BIGINT" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1) FILTER $3], EXPR$2=[MIN($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], ENAME=[$1], EXPR$2=[$2], $g_0=[=($3, 0)], $g_1=[=($3, 1)])\n LogicalProject(DEPTNO=[$1], ENAME=[$0], EXPR$2=[$2], $g=[$3])\n LogicalAggregate(group=[{1, 7}], groups=[[{1, 7}, {7}]], EXPR$2=[SUM($5)], $g=[GROUPING($7, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctCount3.json b/tests/calcite/testDistinctCount3.json new file mode 100644 index 0000000..c3e9dfc --- /dev/null +++ b/tests/calcite/testDistinctCount3.json @@ -0,0 +1,390 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BIGINT" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$2])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT(DISTINCT $0)], EXPR$1=[SUM($1)])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$2])\n LogicalProject(DEPTNO=[$0], EXPR$0=[$1], EXPR$1=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT($0) FILTER $2], EXPR$1=[MIN($1) FILTER $2])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $g_0=[=($2, 0)])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], $g=[GROUPING($0)])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctCountGroupingSets1.json b/tests/calcite/testDistinctCountGroupingSets1.json new file mode 100644 index 0000000..c9556ac --- /dev/null +++ b/tests/calcite/testDistinctCountGroupingSets1.json @@ -0,0 +1,428 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "GROUPING", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "GROUPING", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT(DISTINCT $2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT($2) FILTER $3])\n LogicalProject(DEPTNO=[$0], JOB=[$1], ENAME=[$2], $g_0=[=($3, 0)])\n LogicalAggregate(group=[{0, 1, 2}], $g=[GROUPING($0, $1, $2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctCountGroupingSets2.json b/tests/calcite/testDistinctCountGroupingSets2.json new file mode 100644 index 0000000..e0b30c4 --- /dev/null +++ b/tests/calcite/testDistinctCountGroupingSets2.json @@ -0,0 +1,531 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT(DISTINCT $2)], EXPR$3=[SUM($3)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], JOB=[$1], EXPR$2=[$2], EXPR$3=[CAST($3):INTEGER NOT NULL])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT($2) FILTER $4], EXPR$3=[MIN($3) FILTER $5])\n LogicalProject(DEPTNO=[$0], JOB=[$1], ENAME=[$2], EXPR$3=[$3], $g_0=[=($4, 0)], $g_1=[=($4, 1)])\n LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1, 2}, {0, 1}]], EXPR$3=[SUM($3)], $g=[GROUPING($0, $1, $2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctCountMixed.json b/tests/calcite/testDistinctCountMixed.json new file mode 100644 index 0000000..2c8d3b5 --- /dev/null +++ b/tests/calcite/testDistinctCountMixed.json @@ -0,0 +1,452 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BIGINT" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], CDDJ=[COUNT(DISTINCT $0, $1)], S=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], CDDJ=[$1], S=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], CDDJ=[COUNT($0, $1) FILTER $3], S=[MIN($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], JOB=[$1], S=[$2], $g_0=[=($3, 0)], $g_1=[=($3, 1)])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]], S=[SUM($2)], $g=[GROUPING($0, $1)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctCountMixed2.json b/tests/calcite/testDistinctCountMixed2.json new file mode 100644 index 0000000..1c42764 --- /dev/null +++ b/tests/calcite/testDistinctCountMixed2.json @@ -0,0 +1,532 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], CDE=[COUNT(DISTINCT $1)], CDJE=[COUNT(DISTINCT $2, $1)], CDDJ=[COUNT(DISTINCT $0, $2)], S=[SUM($3)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], CDE=[$1], CDJE=[$2], CDDJ=[$3], S=[CAST($4):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], CDE=[COUNT($1) FILTER $5], CDJE=[COUNT($2, $1) FILTER $4], CDDJ=[COUNT($0, $2) FILTER $6], S=[MIN($3) FILTER $7])\n LogicalProject(DEPTNO=[$2], ENAME=[$0], JOB=[$1], S=[$3], $g_0=[=($4, 0)], $g_1=[=($4, 1)], $g_2=[=($4, 2)], $g_3=[=($4, 3)])\n LogicalAggregate(group=[{1, 2, 7}], groups=[[{1, 2, 7}, {1, 7}, {2, 7}, {7}]], S=[SUM($5)], $g=[GROUPING($7, $1, $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctCountMixedJoin.json b/tests/calcite/testDistinctCountMixedJoin.json new file mode 100644 index 0000000..2ec708e --- /dev/null +++ b/tests/calcite/testDistinctCountMixedJoin.json @@ -0,0 +1,733 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + }, { + "column" : 5, + "type" : "BIGINT" + }, { + "column" : 7, + "type" : "BIGINT" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "IS NOT DISTINCT FROM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "IS NOT DISTINCT FROM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "IS NOT DISTINCT FROM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[COUNT(DISTINCT $2, $1)], EXPR$3=[COUNT(DISTINCT $0, $2)], EXPR$4=[SUM($3)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$3], EXPR$2=[$5], EXPR$3=[$7], EXPR$4=[$1])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $6)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{7}], EXPR$4=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$1=[COUNT($0)])\n LogicalAggregate(group=[{1, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{2}], EXPR$2=[COUNT($1, $0)])\n LogicalAggregate(group=[{1, 2, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$3=[COUNT($1, $0)])\n LogicalAggregate(group=[{2, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctCountMultiple.json b/tests/calcite/testDistinctCountMultiple.json new file mode 100644 index 0000000..a02796f --- /dev/null +++ b/tests/calcite/testDistinctCountMultiple.json @@ -0,0 +1,420 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "GROUPING", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "GROUPING", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[COUNT(DISTINCT $2)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1) FILTER $3], EXPR$2=[COUNT($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], ENAME=[$1], JOB=[$2], $g_1=[=($3, 1)], $g_2=[=($3, 2)])\n LogicalProject(DEPTNO=[$2], ENAME=[$0], JOB=[$1], $g=[$3])\n LogicalAggregate(group=[{1, 2, 7}], groups=[[{1, 7}, {2, 7}]], $g=[GROUPING($7, $1, $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctCountMultipleNoGroup.json b/tests/calcite/testDistinctCountMultipleNoGroup.json new file mode 100644 index 0000000..bc52b7b --- /dev/null +++ b/tests/calcite/testDistinctCountMultipleNoGroup.json @@ -0,0 +1,316 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "GROUPING", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "GROUPING", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(ENAME=[$1], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT($0) FILTER $2], EXPR$1=[COUNT($1) FILTER $3])\n LogicalProject(ENAME=[$0], JOB=[$1], $g_1=[=($2, 1)], $g_2=[=($2, 2)])\n LogicalAggregate(group=[{1, 2}], groups=[[{1}, {2}]], $g=[GROUPING($1, $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctCountMultipleViaJoin.json b/tests/calcite/testDistinctCountMultipleViaJoin.json new file mode 100644 index 0000000..2ec708e --- /dev/null +++ b/tests/calcite/testDistinctCountMultipleViaJoin.json @@ -0,0 +1,733 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + }, { + "column" : 5, + "type" : "BIGINT" + }, { + "column" : 7, + "type" : "BIGINT" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "IS NOT DISTINCT FROM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "IS NOT DISTINCT FROM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "IS NOT DISTINCT FROM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[COUNT(DISTINCT $2, $1)], EXPR$3=[COUNT(DISTINCT $0, $2)], EXPR$4=[SUM($3)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$3], EXPR$2=[$5], EXPR$3=[$7], EXPR$4=[$1])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $6)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{7}], EXPR$4=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$1=[COUNT($0)])\n LogicalAggregate(group=[{1, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{2}], EXPR$2=[COUNT($1, $0)])\n LogicalAggregate(group=[{1, 2, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$3=[COUNT($1, $0)])\n LogicalAggregate(group=[{2, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctCountWithExpandSumType.json b/tests/calcite/testDistinctCountWithExpandSumType.json new file mode 100644 index 0000000..e2f56c2 --- /dev/null +++ b/tests/calcite/testDistinctCountWithExpandSumType.json @@ -0,0 +1,250 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "operator" : "CAST", + "operand" : [ { + "column" : 0, + "type" : "DECIMAL" + } ], + "type" : "BIGINT" + }, { + "column" : 1, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "DECIMAL" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()], EXPR$1=[COUNT(DISTINCT $0)])\n LogicalProject(COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[CAST($0):BIGINT NOT NULL], EXPR$1=[$1])\n LogicalAggregate(group=[{}], EXPR$0=[$SUM0($1)], EXPR$1=[COUNT($0)])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctCountWithoutGroupBy.json b/tests/calcite/testDistinctCountWithoutGroupBy.json new file mode 100644 index 0000000..2d6ead9 --- /dev/null +++ b/tests/calcite/testDistinctCountWithoutGroupBy.json @@ -0,0 +1,302 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[MAX($0)], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[MIN($1) FILTER $3], EXPR$1=[COUNT($0) FILTER $2])\n LogicalProject(ENAME=[$0], EXPR$0=[$1], $g_0=[=($2, 0)], $g_1=[=($2, 1)])\n LogicalAggregate(group=[{1}], groups=[[{1}, {}]], EXPR$0=[MAX($7)], $g=[GROUPING($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctNonDistinctAggregates.json b/tests/calcite/testDistinctNonDistinctAggregates.json new file mode 100644 index 0000000..77d3dc1 --- /dev/null +++ b/tests/calcite/testDistinctNonDistinctAggregates.json @@ -0,0 +1,426 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "AVG", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "AVG", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT()], EXPR$2=[AVG(DISTINCT $1)])\n LogicalProject(EMPNO=[$0], DEPTNO0=[$9])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($2)], EXPR$2=[AVG($1)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT()])\n LogicalProject(EMPNO=[$0], DEPTNO0=[$9])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctNonDistinctAggregatesWithGrouping1.json b/tests/calcite/testDistinctNonDistinctAggregatesWithGrouping1.json new file mode 100644 index 0000000..58e61f4 --- /dev/null +++ b/tests/calcite/testDistinctNonDistinctAggregatesWithGrouping1.json @@ -0,0 +1,404 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($0)], EXPR$2=[SUM(DISTINCT $1)], EXPR$3=[MAX($0)], EXPR$4=[MAX($2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($2)], EXPR$2=[SUM($1)], EXPR$3=[MAX($3)], EXPR$4=[MAX($4)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM($0)], EXPR$3=[MAX($0)], EXPR$4=[MAX($2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctNonDistinctAggregatesWithGrouping2.json b/tests/calcite/testDistinctNonDistinctAggregatesWithGrouping2.json new file mode 100644 index 0000000..5558e65 --- /dev/null +++ b/tests/calcite/testDistinctNonDistinctAggregatesWithGrouping2.json @@ -0,0 +1,305 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT()], EXPR$2=[SUM(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($2)], EXPR$2=[SUM($1)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT()])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctNonDistinctTwoAggregatesWithGrouping.json b/tests/calcite/testDistinctNonDistinctTwoAggregatesWithGrouping.json new file mode 100644 index 0000000..470f936 --- /dev/null +++ b/tests/calcite/testDistinctNonDistinctTwoAggregatesWithGrouping.json @@ -0,0 +1,368 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[SUM(DISTINCT $2)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($2)], EXPR$2=[MIN($3)], EXPR$3=[SUM($1)])\n LogicalAggregate(group=[{0, 2}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctWithDiffFiltersAndSameGroupSet.json b/tests/calcite/testDistinctWithDiffFiltersAndSameGroupSet.json new file mode 100644 index 0000000..5c42b37 --- /dev/null +++ b/tests/calcite/testDistinctWithDiffFiltersAndSameGroupSet.json @@ -0,0 +1,484 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "500", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "500", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 1, + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 0, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "500", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "GROUPING", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 2, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "500", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 1, + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 0, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "500", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "GROUPING", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 2, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "500", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT(DISTINCT $0) FILTER $1], EXPR$1=[COUNT(DISTINCT $1) FILTER $0])\n LogicalProject(C=[>($5, 1000)], D=[<($5, 500)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT($0) FILTER $3], EXPR$1=[COUNT($1) FILTER $2])\n LogicalProject(C=[$0], D=[$1], $g_0_f_0=[AND(=($2, 0), $0)], $g_0_f_1=[AND(=($2, 0), $1)])\n LogicalAggregate(group=[{0, 1}], $g=[GROUPING($0, $1)])\n LogicalProject(C=[>($5, 1000)], D=[<($5, 500)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctWithFilterAndGroupBy.json b/tests/calcite/testDistinctWithFilterAndGroupBy.json new file mode 100644 index 0000000..301c173 --- /dev/null +++ b/tests/calcite/testDistinctWithFilterAndGroupBy.json @@ -0,0 +1,566 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + }, { + "column" : 6, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "column" : 3, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BOOLEAN" + }, { + "column" : 7, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT(DISTINCT $2) FILTER $3])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5], $f3=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[CAST($1):INTEGER NOT NULL], EXPR$2=[$2])\n LogicalAggregate(group=[{0}], EXPR$1=[MIN($2) FILTER $4], EXPR$2=[COUNT($1) FILTER $3])\n LogicalProject(DEPTNO=[$0], SAL=[$1], EXPR$1=[$3], $g_0_f_2=[AND(=($4, 0), IS TRUE($2))], $g_3=[=($4, 3)])\n LogicalAggregate(group=[{0, 2, 3}], groups=[[{0, 2, 3}, {0}]], EXPR$1=[SUM($1)], $g=[GROUPING($0, $2, $3)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5], $f3=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctWithFilterWithoutGroupBy.json b/tests/calcite/testDistinctWithFilterWithoutGroupBy.json new file mode 100644 index 0000000..2870304 --- /dev/null +++ b/tests/calcite/testDistinctWithFilterWithoutGroupBy.json @@ -0,0 +1,466 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + }, { + "column" : 4, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + }, { + "column" : 4, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT(DISTINCT $1) FILTER $2])\n LogicalProject(COMM=[$6], SAL=[$5], $f2=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[MIN($1) FILTER $3], EXPR$1=[COUNT($0) FILTER $2])\n LogicalProject(SAL=[$0], EXPR$0=[$2], $g_0_f_1=[AND(=($3, 0), IS TRUE($1))], $g_3=[=($3, 3)])\n LogicalAggregate(group=[{1, 2}], groups=[[{1, 2}, {}]], EXPR$0=[SUM($0)], $g=[GROUPING($1, $2)])\n LogicalProject(COMM=[$6], SAL=[$5], $f2=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctWithGrouping.json b/tests/calcite/testDistinctWithGrouping.json new file mode 100644 index 0000000..546bed0 --- /dev/null +++ b/tests/calcite/testDistinctWithGrouping.json @@ -0,0 +1,324 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[SUM(DISTINCT $0)])\n LogicalProject(SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($2)], EXPR$3=[SUM($0)])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalProject(SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctWithMultipleInputs.json b/tests/calcite/testDistinctWithMultipleInputs.json new file mode 100644 index 0000000..e384c56 --- /dev/null +++ b/tests/calcite/testDistinctWithMultipleInputs.json @@ -0,0 +1,400 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[COUNT(DISTINCT $2, $1)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($3)], EXPR$2=[MIN($4)], EXPR$3=[COUNT($2, $1)])\n LogicalAggregate(group=[{0, 1, 2}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testDistinctWithMultipleInputsAndGroupby.json b/tests/calcite/testDistinctWithMultipleInputsAndGroupby.json new file mode 100644 index 0000000..d4f29d1 --- /dev/null +++ b/tests/calcite/testDistinctWithMultipleInputsAndGroupby.json @@ -0,0 +1,406 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[COUNT(DISTINCT $2, $0, $1)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($3)], EXPR$2=[MIN($4)], EXPR$3=[COUNT($2, $0, $1)])\n LogicalAggregate(group=[{0, 1, 2}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testEmptyAggregate.json b/tests/calcite/testEmptyAggregate.json new file mode 100644 index 0000000..e1871b7 --- /dev/null +++ b/tests/calcite/testEmptyAggregate.json @@ -0,0 +1,73 @@ +{ + "schemas" : [ ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ ] + } + } + } + } + } + } ] + } + } + } + }, { + "values" : { + "schema" : [ "INTEGER" ], + "content" : [ ] + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[SUM($1)])\n LogicalValues(tuples=[[]])\n", "LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json b/tests/calcite/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json new file mode 100644 index 0000000..1966230 --- /dev/null +++ b/tests/calcite/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json @@ -0,0 +1,66 @@ +{ + "schemas" : [ ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "values" : { + "schema" : [ "INTEGER" ], + "content" : [ ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "values" : { + "schema" : [ "INTEGER" ], + "content" : [ ] + } + } + } + } + } + } ] + } + }, { + "values" : { + "schema" : [ "BIGINT", "INTEGER" ], + "content" : [ [ { + "operator" : "0", + "operand" : [ ], + "type" : "BIGINT" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()], EXPR$1=[SUM($0)])\n LogicalValues(tuples=[[]])\n", "LogicalValues(tuples=[[{ 0, null }]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testEmptyFilterProjectUnion.json b/tests/calcite/testEmptyFilterProjectUnion.json new file mode 100644 index 0000000..22c6efa --- /dev/null +++ b/tests/calcite/testEmptyFilterProjectUnion.json @@ -0,0 +1,121 @@ +{ + "schemas" : [ ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], [ { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + } ] + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + } ], + "help" : [ "LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>(+($0, $1), 30)])\n LogicalUnion(all=[true])\n LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 20, 2 }]])\n", "LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testEmptyIntersect.json b/tests/calcite/testEmptyIntersect.json new file mode 100644 index 0000000..2d83054 --- /dev/null +++ b/tests/calcite/testEmptyIntersect.json @@ -0,0 +1,110 @@ +{ + "schemas" : [ ], + "queries" : [ { + "intersect" : [ { + "intersect" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "50", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], [ { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + } + } + } ] + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + } ] + }, { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ ] + } + } ], + "help" : [ "LogicalIntersect(all=[false])\n LogicalIntersect(all=[false])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 50)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n", "LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testEmptyMinus.json b/tests/calcite/testEmptyMinus.json new file mode 100644 index 0000000..53f9449 --- /dev/null +++ b/tests/calcite/testEmptyMinus.json @@ -0,0 +1,106 @@ +{ + "schemas" : [ ], + "queries" : [ { + "distinct" : { + "except" : [ { + "distinct" : { + "except" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "40", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + } ] + } + }, { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ ] + } + } ], + "help" : [ "LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 30)])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 20, 2 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 40, 4 }]])\n", "LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testEmptyMinus2.json b/tests/calcite/testEmptyMinus2.json new file mode 100644 index 0000000..928985d --- /dev/null +++ b/tests/calcite/testEmptyMinus2.json @@ -0,0 +1,197 @@ +{ + "schemas" : [ ], + "queries" : [ { + "distinct" : { + "except" : [ { + "distinct" : { + "except" : [ { + "distinct" : { + "except" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "40", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "50", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "50", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "except" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "40", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + } ] + } + } ], + "help" : [ "LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 30)])\n LogicalValues(tuples=[[{ 20, 2 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 40, 4 }]])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 50)])\n LogicalValues(tuples=[[{ 50, 5 }]])\n", "LogicalMinus(all=[false])\n LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 40, 4 }]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testEmptyProject.json b/tests/calcite/testEmptyProject.json new file mode 100644 index 0000000..6d576b5 --- /dev/null +++ b/tests/calcite/testEmptyProject.json @@ -0,0 +1,76 @@ +{ + "schemas" : [ ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "50", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], [ { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + } + } + }, { + "values" : { + "schema" : [ "INTEGER" ], + "content" : [ ] + } + } ], + "help" : [ "LogicalProject(EXPR$0=[+(+($0, $1), $0)])\n LogicalFilter(condition=[>(+($0, $1), 50)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n", "LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testEmptyProject2.json b/tests/calcite/testEmptyProject2.json new file mode 100644 index 0000000..6d576b5 --- /dev/null +++ b/tests/calcite/testEmptyProject2.json @@ -0,0 +1,76 @@ +{ + "schemas" : [ ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "50", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], [ { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + } + } + }, { + "values" : { + "schema" : [ "INTEGER" ], + "content" : [ ] + } + } ], + "help" : [ "LogicalProject(EXPR$0=[+(+($0, $1), $0)])\n LogicalFilter(condition=[>(+($0, $1), 50)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n", "LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testEmptySort.json b/tests/calcite/testEmptySort.json new file mode 100644 index 0000000..9aaf6a7 --- /dev/null +++ b/tests/calcite/testEmptySort.json @@ -0,0 +1,65 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "sort" : { + "collation" : [ [ 7, "INTEGER", "ASC" ] ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] + } + } ], + "help" : [ "LogicalSort(sort0=[$7], dir0=[ASC])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testEmptySort2.json b/tests/calcite/testEmptySort2.json new file mode 100644 index 0000000..a92a47d --- /dev/null +++ b/tests/calcite/testEmptySort2.json @@ -0,0 +1,20 @@ +{ + "schemas" : [ ], + "queries" : [ { + "sort" : { + "collation" : [ [ 1, "VARCHAR", "ASC" ], [ 0, "TINYINT", "ASC" ] ], + "source" : { + "values" : { + "schema" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "content" : [ ] + } + } + } + }, { + "values" : { + "schema" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "content" : [ ] + } + } ], + "help" : [ "LogicalSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[ASC])\n LogicalValues(tuples=[[]])\n", "LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testEmptySortLimitZero.json b/tests/calcite/testEmptySortLimitZero.json new file mode 100644 index 0000000..7d9f9c7 --- /dev/null +++ b/tests/calcite/testEmptySortLimitZero.json @@ -0,0 +1,61 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "sort" : { + "collation" : [ [ 7, "INTEGER", "ASC" ] ], + "limit" : { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] + } + } ], + "help" : [ "LogicalSort(sort0=[$7], dir0=[ASC], fetch=[0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExistsWithAtLeastOneRowSubQuery.json b/tests/calcite/testExistsWithAtLeastOneRowSubQuery.json new file mode 100644 index 0000000..35561cb --- /dev/null +++ b/tests/calcite/testExistsWithAtLeastOneRowSubQuery.json @@ -0,0 +1,136 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "EXISTS", + "operand" : [ ], + "query" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + }, + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[EXISTS({\nLogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[0])\n LogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExistsWithNoRowSubQuery.json b/tests/calcite/testExistsWithNoRowSubQuery.json new file mode 100644 index 0000000..4e89c3d --- /dev/null +++ b/tests/calcite/testExistsWithNoRowSubQuery.json @@ -0,0 +1,57 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "NOT", + "operand" : [ { + "operator" : "EXISTS", + "operand" : [ ], + "query" : { + "values" : { + "schema" : [ "BIGINT" ], + "content" : [ ] + } + }, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[NOT(EXISTS({\nLogicalValues(tuples=[[]])\n}))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandFilterExists.json b/tests/calcite/testExpandFilterExists.json new file mode 100644 index 0000000..ccdac9c --- /dev/null +++ b/tests/calcite/testExpandFilterExists.json @@ -0,0 +1,235 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "EXISTS", + "operand" : [ ], + "query" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($5, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IS NOT NULL($9), <($5, 100))])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandFilterExistsSimple.json b/tests/calcite/testExpandFilterExistsSimple.json new file mode 100644 index 0000000..087e87e --- /dev/null +++ b/tests/calcite/testExpandFilterExistsSimple.json @@ -0,0 +1,193 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "EXISTS", + "operand" : [ ], + "query" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandFilterExistsSimpleAnd.json b/tests/calcite/testExpandFilterExistsSimpleAnd.json new file mode 100644 index 0000000..a88971e --- /dev/null +++ b/tests/calcite/testExpandFilterExistsSimpleAnd.json @@ -0,0 +1,224 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "EXISTS", + "operand" : [ ], + "query" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[AND(EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($5, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[<($5, 100)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandFilterIn.json b/tests/calcite/testExpandFilterIn.json new file mode 100644 index 0000000..5e3b54e --- /dev/null +++ b/tests/calcite/testExpandFilterIn.json @@ -0,0 +1,271 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "IN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 16, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 10, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IN($7, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($5, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IS NOT NULL($10), <($5, 100))])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandFilterIn3Value.json b/tests/calcite/testExpandFilterIn3Value.json new file mode 100644 index 0000000..f2b1076 --- /dev/null +++ b/tests/calcite/testExpandFilterIn3Value.json @@ -0,0 +1,639 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "operator" : "IN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "type" : "BOOLEAN" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "IN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "type" : "BOOLEAN" + }, { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 12, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "column" : 9, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 12, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "column" : 9, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[<($0, CASE(=(IN($7, {\nLogicalProject(EXPR$0=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), true), 10, =(IN($7, {\nLogicalProject(EXPR$0=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), false), 20, 30))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[<($0, CASE(=(CASE(=($9, 0), false, IS NOT NULL($12), true, <($10, $9), null:BOOLEAN, false), true), 10, =(CASE(=($9, 0), false, IS NOT NULL($12), true, <($10, $9), null:BOOLEAN, false), false), 20, 30))])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(EXPR$0=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(EXPR$0=[CASE(true, CAST($7):INTEGER, null:INTEGER)], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandFilterInComposite.json b/tests/calcite/testExpandFilterInComposite.json new file mode 100644 index 0000000..0ed925b --- /dev/null +++ b/tests/calcite/testExpandFilterInComposite.json @@ -0,0 +1,215 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "IN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 11, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($5, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IS NOT NULL($11), <($5, 100))])\n LogicalJoin(condition=[AND(=($0, $9), =($7, $10))], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandFilterScalar.json b/tests/calcite/testExpandFilterScalar.json new file mode 100644 index 0000000..57d47b6 --- /dev/null +++ b/tests/calcite/testExpandFilterScalar.json @@ -0,0 +1,370 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "operator" : "$SCALAR_QUERY", + "operand" : [ ], + "query" : { + "project" : { + "target" : [ { + "column" : 16, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "type" : "INTEGER" + }, { + "operator" : "$SCALAR_QUERY", + "operand" : [ ], + "query" : { + "project" : { + "target" : [ { + "column" : 16, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SINGLE_VALUE", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SINGLE_VALUE", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(<($SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), $SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})), <($5, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(<($9, $10), <($5, 100))])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandJoinExists.json b/tests/calcite/testExpandJoinExists.json new file mode 100644 index 0000000..fc923cc --- /dev/null +++ b/tests/calcite/testExpandJoinExists.json @@ -0,0 +1,223 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "EXISTS", + "operand" : [ ], + "query" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 1 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandJoinScalar.json b/tests/calcite/testExpandJoinScalar.json new file mode 100644 index 0000000..09c5112 --- /dev/null +++ b/tests/calcite/testExpandJoinScalar.json @@ -0,0 +1,402 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "<", + "operand" : [ { + "operator" : "$SCALAR_QUERY", + "operand" : [ ], + "query" : { + "project" : { + "target" : [ { + "column" : 18, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "type" : "INTEGER" + }, { + "operator" : "$SCALAR_QUERY", + "operand" : [ ], + "query" : { + "project" : { + "target" : [ { + "column" : 18, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 1 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SINGLE_VALUE", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SINGLE_VALUE", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[<($SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), $SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10], $f0=[$11])\n LogicalJoin(condition=[<($11, $12)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandProjectExists.json b/tests/calcite/testExpandProjectExists.json new file mode 100644 index 0000000..56faae1 --- /dev/null +++ b/tests/calcite/testExpandProjectExists.json @@ -0,0 +1,163 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "EXISTS", + "operand" : [ ], + "query" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], D=[EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], D=[IS NOT NULL($9)])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandProjectIn.json b/tests/calcite/testExpandProjectIn.json new file mode 100644 index 0000000..aad384c --- /dev/null +++ b/tests/calcite/testExpandProjectIn.json @@ -0,0 +1,211 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "IN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 16, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 10, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], D=[IN($7, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], D=[CASE(IS NOT NULL($10), true, false)])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandProjectInComposite.json b/tests/calcite/testExpandProjectInComposite.json new file mode 100644 index 0000000..70d2473 --- /dev/null +++ b/tests/calcite/testExpandProjectInComposite.json @@ -0,0 +1,155 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "IN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 11, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], D=[IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], D=[CASE(IS NOT NULL($11), true, false)])\n LogicalJoin(condition=[AND(=($0, $9), =($7, $10))], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandProjectInNullable.json b/tests/calcite/testExpandProjectInNullable.json new file mode 100644 index 0000000..d5e61d6 --- /dev/null +++ b/tests/calcite/testExpandProjectInNullable.json @@ -0,0 +1,535 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "IN", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 12, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "column" : 9, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + } ] + } + } + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], D=[IN(CASE(true, CAST($7):INTEGER, null:INTEGER), {\nLogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], D=[CASE(=($9, 0), false, IS NULL(CASE(true, CAST($7):INTEGER, null:INTEGER)), null:BOOLEAN, IS NOT NULL($12), true, <($10, $9), null:BOOLEAN, false)])\n LogicalJoin(condition=[=(CASE(true, CAST($7):INTEGER, null:INTEGER), $11)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$1], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandProjectScalar.json b/tests/calcite/testExpandProjectScalar.json new file mode 100644 index 0000000..cb51619 --- /dev/null +++ b/tests/calcite/testExpandProjectScalar.json @@ -0,0 +1,161 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "$SCALAR_QUERY", + "operand" : [ ], + "query" : { + "project" : { + "target" : [ { + "column" : 16, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SINGLE_VALUE", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], D=[$SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], D=[$9])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandWhereComparisonCorrelated.json b/tests/calcite/testExpandWhereComparisonCorrelated.json new file mode 100644 index 0000000..19a4f51 --- /dev/null +++ b/tests/calcite/testExpandWhereComparisonCorrelated.json @@ -0,0 +1,262 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "$SCALAR_QUERY", + "operand" : [ ], + "query" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 14, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 14, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "correlate" : [ { + "scan" : 0 + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 14, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 14, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=($5, $SCALAR_QUERY({\nLogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(SAL=[$5])\n LogicalFilter(condition=[=($0, $cor0.EMPNO)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($5, $9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(SAL=[$5])\n LogicalFilter(condition=[=($0, $cor0.EMPNO)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExpressionSimplification1.json b/tests/calcite/testExpressionSimplification1.json new file mode 100644 index 0000000..8c311bf --- /dev/null +++ b/tests/calcite/testExpressionSimplification1.json @@ -0,0 +1,127 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "<>", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1''", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'3'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "SEARCH", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "Sarg[(-∞.._ISO-8859-1''), (_ISO-8859-1''.._ISO-8859-1'3'), (_ISO-8859-1'3'..+∞)]", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(<>($1, ''), <>($1, '3'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[SEARCH($1, Sarg[(-∞..'':VARCHAR(20)), ('':VARCHAR(20)..'3':VARCHAR(20)), ('3':VARCHAR(20)..+∞)]:VARCHAR(20))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExpressionSimplification2.json b/tests/calcite/testExpressionSimplification2.json new file mode 100644 index 0000000..2803e82 --- /dev/null +++ b/tests/calcite/testExpressionSimplification2.json @@ -0,0 +1,157 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1''", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1''", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "OR", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'3'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'3'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "SEARCH", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "Sarg[(-∞.._ISO-8859-1''), (_ISO-8859-1''.._ISO-8859-1'3'), (_ISO-8859-1'3'..+∞)]", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(OR(<($1, ''), >($1, '')), OR(<($1, '3'), >($1, '3')))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[SEARCH($1, Sarg[(-∞..'':CHAR(1)), ('':CHAR(1)..'3'), ('3'..+∞)]:CHAR(1))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExtractJoinFilterRule.json b/tests/calcite/testExtractJoinFilterRule.json new file mode 100644 index 0000000..7d3dda4 --- /dev/null +++ b/tests/calcite/testExtractJoinFilterRule.json @@ -0,0 +1,88 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[=($7, $9)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExtractYearMonthToRange.json b/tests/calcite/testExtractYearMonthToRange.json new file mode 100644 index 0000000..42e45c8 --- /dev/null +++ b/tests/calcite/testExtractYearMonthToRange.json @@ -0,0 +1,149 @@ +{ + "schemas" : [ { + "name" : "EMP_B", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER", "BIRTHDATE" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN", "DATE" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "DATE" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "operator" : "EXTRACT", + "operand" : [ { + "operator" : "YEAR", + "operand" : [ ], + "type" : "SYMBOL" + }, { + "column" : 9, + "type" : "DATE" + } ], + "type" : "BIGINT" + }, { + "operator" : "2014", + "operand" : [ ], + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "EXTRACT", + "operand" : [ { + "operator" : "MONTH", + "operand" : [ ], + "type" : "SYMBOL" + }, { + "column" : 9, + "type" : "DATE" + } ], + "type" : "BIGINT" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "DATE" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "SEARCH", + "operand" : [ { + "column" : 9, + "type" : "DATE" + }, { + "operator" : "Sarg[[2014-04-01..2014-05-01)]", + "operand" : [ ], + "type" : "DATE" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[AND(=(EXTRACT(FLAG(YEAR), $9), 2014), =(EXTRACT(FLAG(MONTH), $9), 4))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[SEARCH($9, Sarg[[2014-04-01..2014-05-01)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testExtractYearToRange.json b/tests/calcite/testExtractYearToRange.json new file mode 100644 index 0000000..4e89ba6 --- /dev/null +++ b/tests/calcite/testExtractYearToRange.json @@ -0,0 +1,126 @@ +{ + "schemas" : [ { + "name" : "EMP_B", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER", "BIRTHDATE" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN", "DATE" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "DATE" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "EXTRACT", + "operand" : [ { + "operator" : "YEAR", + "operand" : [ ], + "type" : "SYMBOL" + }, { + "column" : 9, + "type" : "DATE" + } ], + "type" : "BIGINT" + }, { + "operator" : "2014", + "operand" : [ ], + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "DATE" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "SEARCH", + "operand" : [ { + "column" : 9, + "type" : "DATE" + }, { + "operator" : "Sarg[[2014-01-01..2015-01-01)]", + "operand" : [ ], + "type" : "DATE" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[=(EXTRACT(FLAG(YEAR), $9), 2014)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[SEARCH($9, Sarg[[2014-01-01..2015-01-01)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testFilterJoinRuleAndIsNotNull.json b/tests/calcite/testFilterJoinRuleAndIsNotNull.json new file mode 100644 index 0000000..808b5dd --- /dev/null +++ b/tests/calcite/testFilterJoinRuleAndIsNotNull.json @@ -0,0 +1,206 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalFilter(condition=[AND(IS NOT NULL($9), IS NOT NULL($10))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[CAST($9):INTEGER], NAME=[CAST($10):VARCHAR(10)])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testFilterJoinRuleOrIsNotNull.json b/tests/calcite/testFilterJoinRuleOrIsNotNull.json new file mode 100644 index 0000000..bd5adb8 --- /dev/null +++ b/tests/calcite/testFilterJoinRuleOrIsNotNull.json @@ -0,0 +1,206 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalFilter(condition=[OR(IS NOT NULL($9), IS NOT NULL($10))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[CAST($9):INTEGER], NAME=[CAST($10):VARCHAR(10)])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testFilterProjectTranspose.json b/tests/calcite/testFilterProjectTranspose.json new file mode 100644 index 0000000..fe0e4f5 --- /dev/null +++ b/tests/calcite/testFilterProjectTranspose.json @@ -0,0 +1,315 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "correlate" : [ { + "scan" : 0 + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "*", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "*", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "correlate" : [ { + "scan" : 0 + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "*", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "*", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalProject(TWICEDEPTNO=[*($0, 2)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalProject(TWICEDEPTNO=[*($0, 2)])\n LogicalFilter(condition=[=($cor0.DEPTNO, *($0, 2))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testFilterRemoveIsNotDistinctFromRule.json b/tests/calcite/testFilterRemoveIsNotDistinctFromRule.json new file mode 100644 index 0000000..a8056cd --- /dev/null +++ b/tests/calcite/testFilterRemoveIsNotDistinctFromRule.json @@ -0,0 +1,48 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "filter" : { + "condition" : { + "operator" : "IS NOT DISTINCT FROM", + "operand" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalFilter(condition=[IS NOT DISTINCT FROM($7, 20)])\n LogicalTableScan(table=[[scott, EMP]])\n", "LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[scott, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testFlattenUncorrelatedCallBelowEquals.json b/tests/calcite/testFlattenUncorrelatedCallBelowEquals.json new file mode 100644 index 0000000..7fbc096 --- /dev/null +++ b/tests/calcite/testFlattenUncorrelatedCallBelowEquals.json @@ -0,0 +1,442 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "correlate" : [ { + "scan" : 0 + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "correlate" : [ { + "scan" : 0 + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, +($7, 30))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($cor0.DEPTNO, $9)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json b/tests/calcite/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json new file mode 100644 index 0000000..c7a0e61 --- /dev/null +++ b/tests/calcite/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json @@ -0,0 +1,474 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "correlate" : [ { + "scan" : 0 + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "correlate" : [ { + "scan" : 0 + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, +(*(2, $7), 30))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($cor0.DEPTNO, $9)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+(*(2, $7), 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testFullOuterJoinSimplificationToInner.json b/tests/calcite/testFullOuterJoinSimplificationToInner.json new file mode 100644 index 0000000..1747456 --- /dev/null +++ b/tests/calcite/testFullOuterJoinSimplificationToInner.json @@ -0,0 +1,220 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'Charlie'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CAST", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 6, + "type" : "TIMESTAMP" + } ], + "type" : "TIMESTAMP" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 10, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'Charlie'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[AND(=($1, 'Charlie'), >($7, 100))])\n LogicalJoin(condition=[=($0, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalProject(DEPTNO=[CAST($0):INTEGER], NAME=[CAST($1):VARCHAR(10)], EMPNO=[CAST($2):INTEGER], ENAME=[CAST($3):VARCHAR(20)], JOB=[CAST($4):VARCHAR(10)], MGR=[$5], HIREDATE=[CAST($6):TIMESTAMP(0)], SAL=[CAST($7):INTEGER], COMM=[CAST($8):INTEGER], DEPTNO0=[CAST($9):INTEGER], SLACKER=[CAST($10):BOOLEAN])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testFullOuterJoinSimplificationToLeftOuter.json b/tests/calcite/testFullOuterJoinSimplificationToLeftOuter.json new file mode 100644 index 0000000..8471efb --- /dev/null +++ b/tests/calcite/testFullOuterJoinSimplificationToLeftOuter.json @@ -0,0 +1,157 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'Charlie'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CAST", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'Charlie'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalJoin(condition=[=($0, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalProject(DEPTNO=[CAST($0):INTEGER], NAME=[CAST($1):VARCHAR(10)], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testFullOuterJoinSimplificationToRightOuter.json b/tests/calcite/testFullOuterJoinSimplificationToRightOuter.json new file mode 100644 index 0000000..b11f800 --- /dev/null +++ b/tests/calcite/testFullOuterJoinSimplificationToRightOuter.json @@ -0,0 +1,181 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 6, + "type" : "TIMESTAMP" + } ], + "type" : "TIMESTAMP" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 10, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($7, 100)])\n LogicalJoin(condition=[=($0, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[CAST($2):INTEGER], ENAME=[CAST($3):VARCHAR(20)], JOB=[CAST($4):VARCHAR(10)], MGR=[$5], HIREDATE=[CAST($6):TIMESTAMP(0)], SAL=[CAST($7):INTEGER], COMM=[CAST($8):INTEGER], DEPTNO0=[CAST($9):INTEGER], SLACKER=[CAST($10):BOOLEAN])\n LogicalJoin(condition=[=($0, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testGroupByBooleanLiteralSimple.json b/tests/calcite/testGroupByBooleanLiteralSimple.json new file mode 100644 index 0000000..74818a2 --- /dev/null +++ b/tests/calcite/testGroupByBooleanLiteralSimple.json @@ -0,0 +1,212 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "AVG", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "values" : { + "schema" : [ "BOOLEAN" ], + "content" : [ [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ] ] + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "AVG", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "BOOLEAN" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "values" : { + "schema" : [ "BOOLEAN" ], + "content" : [ [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ] ] + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[true], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[$9], SAL=[$5])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[{ true }]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testGroupByDateLiteralSimple.json b/tests/calcite/testGroupByDateLiteralSimple.json new file mode 100644 index 0000000..f184dce --- /dev/null +++ b/tests/calcite/testGroupByDateLiteralSimple.json @@ -0,0 +1,212 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "DATE" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", + "operand" : [ ], + "type" : "DATE" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "AVG", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "DATE" + }, { + "column" : 1, + "type" : "DATE" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", + "operand" : [ ], + "type" : "DATE" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "DATE" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "DATE" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "values" : { + "schema" : [ "DATE" ], + "content" : [ [ { + "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", + "operand" : [ ], + "type" : "DATE" + } ] ] + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "AVG", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "DATE" + }, { + "column" : 1, + "type" : "DATE" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "DATE" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "values" : { + "schema" : [ "DATE" ], + "content" : [ [ { + "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", + "operand" : [ ], + "type" : "DATE" + } ] ] + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[2022-01-01], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[$9], SAL=[$5])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[{ 2022-01-01 }]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testGroupByMultipleLiterals.json b/tests/calcite/testGroupByMultipleLiterals.json new file mode 100644 index 0000000..c46dbdf --- /dev/null +++ b/tests/calcite/testGroupByMultipleLiterals.json @@ -0,0 +1,432 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "CHAR" + }, { + "column" : 5, + "type" : "DATE" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "_ISO-8859-1'ab'", + "operand" : [ ], + "type" : "CHAR" + }, { + "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", + "operand" : [ ], + "type" : "DATE" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "AVG", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 6, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "CHAR" + }, { + "column" : 10, + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "DATE" + }, { + "column" : 11, + "type" : "DATE" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "column" : 13, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "_ISO-8859-1'ab'", + "operand" : [ ], + "type" : "CHAR" + }, { + "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", + "operand" : [ ], + "type" : "DATE" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "CHAR" + }, { + "column" : 5, + "type" : "DATE" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "BOOLEAN" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "CHAR" + }, { + "column" : 12, + "type" : "DATE" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "values" : { + "schema" : [ "BOOLEAN", "BOOLEAN", "CHAR", "DATE" ], + "content" : [ [ { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'ab'", + "operand" : [ ], + "type" : "CHAR" + }, { + "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", + "operand" : [ ], + "type" : "DATE" + } ] ] + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "AVG", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 6, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "CHAR" + }, { + "column" : 10, + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "DATE" + }, { + "column" : 11, + "type" : "DATE" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 15, + "type" : "BOOLEAN" + }, { + "column" : 13, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "BOOLEAN" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "CHAR" + }, { + "column" : 18, + "type" : "DATE" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "values" : { + "schema" : [ "BOOLEAN", "BOOLEAN", "CHAR", "DATE" ], + "content" : [ [ { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'ab'", + "operand" : [ ], + "type" : "CHAR" + }, { + "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", + "operand" : [ ], + "type" : "DATE" + } ] ] + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$6])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5}], EXPR$0=[AVG($6)])\n LogicalProject($f0=[false], DEPTNO=[$7], $f2=[true], EMPNO=[$0], $f4=['ab'], $f5=[2022-01-01], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$6])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5}], EXPR$0=[AVG($6)])\n LogicalProject($f0=[$9], DEPTNO=[$7], $f2=[$10], EMPNO=[$0], $f4=[$11], $f5=[$12], SAL=[$5])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[{ false, true, 'ab', 2022-01-01 }]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testInferringPredicatesWithNotOperatorInJoinCondition.json b/tests/calcite/testInferringPredicatesWithNotOperatorInJoinCondition.json new file mode 100644 index 0000000..e3b33d2 --- /dev/null +++ b/tests/calcite/testInferringPredicatesWithNotOperatorInJoinCondition.json @@ -0,0 +1,257 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NOT", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "6", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "NOT", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "6", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : "SEARCH", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "Sarg[(-∞..4), (4..6), (6..+∞)]", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[AND(=($16, $7), NOT(OR(=($7, 4), =($7, 6))))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[=($16, $7)], joinType=[inner])\n LogicalFilter(condition=[NOT(OR(=($7, 4), =($7, 6)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[SEARCH($7, Sarg[(-∞..4), (4..6), (6..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testIntersectToDistinct.json b/tests/calcite/testIntersectToDistinct.json new file mode 100644 index 0000000..4f7a541 --- /dev/null +++ b/tests/calcite/testIntersectToDistinct.json @@ -0,0 +1,1840 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "intersect" : [ { + "intersect" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 13, + "type" : "TIMESTAMP" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 14, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 13, + "type" : "TIMESTAMP" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 14, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 13, + "type" : "TIMESTAMP" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 14, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 13, + "type" : "TIMESTAMP" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 14, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 19, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 20, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 21, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 22, + "type" : "TIMESTAMP" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 23, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 24, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 25, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 17, + "type" : "BOOLEAN" + }, { + "column" : 26, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 18, + "type" : "INTEGER" + }, { + "column" : 19, + "type" : "VARCHAR" + }, { + "column" : 20, + "type" : "VARCHAR" + }, { + "column" : 21, + "type" : "INTEGER" + }, { + "column" : 22, + "type" : "TIMESTAMP" + }, { + "column" : 23, + "type" : "INTEGER" + }, { + "column" : 24, + "type" : "INTEGER" + }, { + "column" : 25, + "type" : "INTEGER" + }, { + "column" : 26, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 25, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 19, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 20, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 21, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 22, + "type" : "TIMESTAMP" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 23, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 24, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 25, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 17, + "type" : "BOOLEAN" + }, { + "column" : 26, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 18, + "type" : "INTEGER" + }, { + "column" : 19, + "type" : "VARCHAR" + }, { + "column" : 20, + "type" : "VARCHAR" + }, { + "column" : 21, + "type" : "INTEGER" + }, { + "column" : 22, + "type" : "TIMESTAMP" + }, { + "column" : 23, + "type" : "INTEGER" + }, { + "column" : 24, + "type" : "INTEGER" + }, { + "column" : 25, + "type" : "INTEGER" + }, { + "column" : 26, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 25, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 19, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 20, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 21, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 22, + "type" : "TIMESTAMP" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 23, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 24, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 25, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 17, + "type" : "BOOLEAN" + }, { + "column" : 26, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 18, + "type" : "INTEGER" + }, { + "column" : 19, + "type" : "VARCHAR" + }, { + "column" : 20, + "type" : "VARCHAR" + }, { + "column" : 21, + "type" : "INTEGER" + }, { + "column" : 22, + "type" : "TIMESTAMP" + }, { + "column" : 23, + "type" : "INTEGER" + }, { + "column" : 24, + "type" : "INTEGER" + }, { + "column" : 25, + "type" : "INTEGER" + }, { + "column" : 26, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 25, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalIntersect(all=[false])\n LogicalIntersect(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($9, 3)])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5, 6, 7, 8}], agg#0=[COUNT()])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5, 6, 7, 8}], agg#0=[COUNT()])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5, 6, 7, 8}], agg#0=[COUNT()])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5, 6, 7, 8}], agg#0=[COUNT()])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json b/tests/calcite/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json new file mode 100644 index 0000000..8b4799d --- /dev/null +++ b/tests/calcite/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json @@ -0,0 +1,114 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ], + "foreign" : [ ] + }, { + "name" : "BONUS", + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "types" : [ "VARCHAR", "VARCHAR", "DECIMAL", "DECIMAL" ], + "strategy" : [ "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ], [ 3 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 8, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 2 + } + } + }, { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 8, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 1 + }, + "right" : { + "scan" : 2 + } + } + } + } + } ], + "help" : [ "LogicalJoin(condition=[=($2, $12)], joinType=[inner])\n LogicalJoin(condition=[=($7, $8)], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, BONUS]])\n", "LogicalJoin(condition=[AND(=($2, $12), =($7, $8))], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, BONUS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json b/tests/calcite/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json new file mode 100644 index 0000000..679d72e --- /dev/null +++ b/tests/calcite/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json @@ -0,0 +1,94 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ] ], + "foreign" : [ ] + }, { + "name" : "BONUS", + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "types" : [ "VARCHAR", "VARCHAR", "DECIMAL", "DECIMAL" ], + "strategy" : [ "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ], [ 3 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 12, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 2 + } + } + }, { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 12, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 1 + }, + "right" : { + "scan" : 2 + } + } + } + } + } ], + "help" : [ "LogicalJoin(condition=[=($7, $12)], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, BONUS]])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalJoin(condition=[=($7, $12)], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, BONUS]])\n LogicalTableScan(table=[[scott, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json b/tests/calcite/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json new file mode 100644 index 0000000..94d798a --- /dev/null +++ b/tests/calcite/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json @@ -0,0 +1,87 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, { + "project" : { + "target" : [ { + "column" : 3, + "type" : "SMALLINT" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "SMALLINT" + }, { + "column" : 7, + "type" : "DATE" + }, { + "column" : 8, + "type" : "DECIMAL" + }, { + "column" : 9, + "type" : "DECIMAL" + }, { + "column" : 10, + "type" : "TINYINT" + }, { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 1 + }, + "right" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(EMPNO=[$3], ENAME=[$4], JOB=[$5], MGR=[$6], HIREDATE=[$7], SAL=[$8], COMM=[$9], DEPTNO=[$10], DEPTNO0=[$0], DNAME=[$1], LOC=[$2])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinConditionPushdown1.json b/tests/calcite/testJoinConditionPushdown1.json new file mode 100644 index 0000000..8f5b58a --- /dev/null +++ b/tests/calcite/testJoinConditionPushdown1.json @@ -0,0 +1,246 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + }, { + "column" : 18, + "type" : "INTEGER" + }, { + "column" : 19, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 0 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + }, { + "column" : 18, + "type" : "INTEGER" + }, { + "column" : 19, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 0 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17], DEPTNO1=[$18], NAME=[$19])\n LogicalFilter(condition=[AND(=($7, $18), =($16, $18))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17], DEPTNO1=[$18], NAME=[$19])\n LogicalJoin(condition=[=($7, $18)], joinType=[inner])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinConditionPushdown2.json b/tests/calcite/testJoinConditionPushdown2.json new file mode 100644 index 0000000..87947c4 --- /dev/null +++ b/tests/calcite/testJoinConditionPushdown2.json @@ -0,0 +1,175 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalFilter(condition=[AND(=($7, $9), =($0, $9))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalFilter(condition=[=($7, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinConditionPushdown4.json b/tests/calcite/testJoinConditionPushdown4.json new file mode 100644 index 0000000..aa0adf9 --- /dev/null +++ b/tests/calcite/testJoinConditionPushdown4.json @@ -0,0 +1,150 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "TINYINT" + } ], + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 2, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "TINYINT" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 8, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[AND(=($0, $2), =($0, $3))], joinType=[semi])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalJoin(condition=[=($7, $8)], joinType=[semi])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalFilter(condition=[=($0, $1)])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinConditionPushdown6.json b/tests/calcite/testJoinConditionPushdown6.json new file mode 100644 index 0000000..92c4092 --- /dev/null +++ b/tests/calcite/testJoinConditionPushdown6.json @@ -0,0 +1,166 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[AND(=($7, $9), =($0, $9))], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalFilter(condition=[=($7, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinDeriveIsNotNullFilterRule1.json b/tests/calcite/testJoinDeriveIsNotNullFilterRule1.json new file mode 100644 index 0000000..4dec753 --- /dev/null +++ b/tests/calcite/testJoinDeriveIsNotNullFilterRule1.json @@ -0,0 +1,94 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($3, $12)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($3, $12)], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinDeriveIsNotNullFilterRule12.json b/tests/calcite/testJoinDeriveIsNotNullFilterRule12.json new file mode 100644 index 0000000..d70a00c --- /dev/null +++ b/tests/calcite/testJoinDeriveIsNotNullFilterRule12.json @@ -0,0 +1,122 @@ +{ + "schemas" : [ { + "name" : "EMPNULLABLES", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT DISTINCT FROM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT DISTINCT FROM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[AND(=($1, $10), IS NOT DISTINCT FROM($3, $12))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[AND(=($1, $10), IS NOT DISTINCT FROM($3, $12))], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinDeriveIsNotNullFilterRule2.json b/tests/calcite/testJoinDeriveIsNotNullFilterRule2.json new file mode 100644 index 0000000..8dca101 --- /dev/null +++ b/tests/calcite/testJoinDeriveIsNotNullFilterRule2.json @@ -0,0 +1,170 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($3, $12)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($3, $12)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinDeriveIsNotNullFilterRule3.json b/tests/calcite/testJoinDeriveIsNotNullFilterRule3.json new file mode 100644 index 0000000..5680647 --- /dev/null +++ b/tests/calcite/testJoinDeriveIsNotNullFilterRule3.json @@ -0,0 +1,94 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[>($3, $12)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[>($3, $12)], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinDeriveIsNotNullFilterRule4.json b/tests/calcite/testJoinDeriveIsNotNullFilterRule4.json new file mode 100644 index 0000000..3c59851 --- /dev/null +++ b/tests/calcite/testJoinDeriveIsNotNullFilterRule4.json @@ -0,0 +1,144 @@ +{ + "schemas" : [ { + "name" : "EMPNULLABLES", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[AND(=($1, $10), >($3, $12))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[AND(=($1, $10), >($3, $12))], joinType=[inner])\n LogicalFilter(condition=[AND(IS NOT NULL($1), IS NOT NULL($3))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[AND(IS NOT NULL($1), IS NOT NULL($3))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinDeriveIsNotNullFilterRule5.json b/tests/calcite/testJoinDeriveIsNotNullFilterRule5.json new file mode 100644 index 0000000..71df99b --- /dev/null +++ b/tests/calcite/testJoinDeriveIsNotNullFilterRule5.json @@ -0,0 +1,144 @@ +{ + "schemas" : [ { + "name" : "EMPNULLABLES", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalProject(ENAME=[$1], DEPTNO=[+($7, 1)])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalProject(ENAME=[$1], DEPTNO=[+($7, 1)])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinProjectTranspose1.json b/tests/calcite/testJoinProjectTranspose1.json new file mode 100644 index 0000000..6c14469 --- /dev/null +++ b/tests/calcite/testJoinProjectTranspose1.json @@ -0,0 +1,159 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "column" : 1, + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "column" : 4, + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 0 + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(NAME=[$0])\n LogicalJoin(condition=[$1], joinType=[right])\n LogicalProject(NAME=[$1], $f4=[$5])\n LogicalJoin(condition=[$4], joinType=[left])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[>($0, 10)], $f4=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$1])\n LogicalJoin(condition=[>($2, 10)], joinType=[right])\n LogicalJoin(condition=[>($2, 10)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinProjectTranspose7.json b/tests/calcite/testJoinProjectTranspose7.json new file mode 100644 index 0000000..b1ee2fc --- /dev/null +++ b/tests/calcite/testJoinProjectTranspose7.json @@ -0,0 +1,104 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$2])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$2])\n LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$3])\n LogicalJoin(condition=[=($1, $3)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinProjectTranspose8.json b/tests/calcite/testJoinProjectTranspose8.json new file mode 100644 index 0000000..01debc4 --- /dev/null +++ b/tests/calcite/testJoinProjectTranspose8.json @@ -0,0 +1,148 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$2], EXPR$1=[$3])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], EXPR$1=[AND(>($0, 10), null)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$2], EXPR$1=[$3])\n LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$3], EXPR$1=[AND(>($2, 10), null)])\n LogicalJoin(condition=[=($1, $3)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinProjectTransposeWindow.json b/tests/calcite/testJoinProjectTransposeWindow.json new file mode 100644 index 0000000..4f10be1 --- /dev/null +++ b/tests/calcite/testJoinProjectTransposeWindow.json @@ -0,0 +1,172 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "BIGINT" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BIGINT" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "error" : "Not implemented: RANK" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "BIGINT" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "CAST", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "error" : "Not implemented: RANK" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1], R=[$3], EXPR$1=[$4])\n LogicalJoin(condition=[=($2, $3)], joinType=[inner])\n LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[CAST($1):BIGINT NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(R=[RANK() OVER (ORDER BY $1)], EXPR$1=[+(1, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1], R=[$3], EXPR$1=[$4])\n LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[CAST($1):BIGINT NOT NULL], R=[$2], EXPR$1=[$3])\n LogicalJoin(condition=[=(CAST($1):BIGINT NOT NULL, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(R=[RANK() OVER (ORDER BY $1)], EXPR$1=[+(1, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinPushTransitivePredicatesRule2.json b/tests/calcite/testJoinPushTransitivePredicatesRule2.json new file mode 100644 index 0000000..2c98457 --- /dev/null +++ b/tests/calcite/testJoinPushTransitivePredicatesRule2.json @@ -0,0 +1,1424 @@ +{ + "schemas" : [ { + "name" : "EMPNULLABLES", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + }, { + "column" : 12, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 12, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "TIMESTAMP" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BOOLEAN" + }, { + "column" : 6, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + }, { + "column" : 12, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 12, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "TIMESTAMP" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BOOLEAN" + }, { + "column" : 6, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(SAL=[$5])\n LogicalJoin(condition=[AND(=($5, $11), =($9, $12))], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], SAL0=[$5], $f9=[=($5, 4)])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[=($1, $0)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalProject(SAL=[$5], SAL0=[$8], $f9=[$9])\n LogicalJoin(condition=[OR(=($8, $5), $9)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(SAL=[$5], $f9=[=($5, 4)])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(SAL=[$5])\n LogicalJoin(condition=[AND(=($5, $11), =($9, $12))], joinType=[inner])\n LogicalFilter(condition=[>($5, 1000)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], SAL0=[$5], $f9=[=($5, 4)])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[=($1, $0)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalProject(SAL=[$5], SAL0=[$8], $f9=[$9])\n LogicalJoin(condition=[OR(=($8, $5), $9)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(SAL=[$5], $f9=[=($5, 4)])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testLeftEmptyAntiJoin.json b/tests/calcite/testLeftEmptyAntiJoin.json new file mode 100644 index 0000000..f0d3483 --- /dev/null +++ b/tests/calcite/testLeftEmptyAntiJoin.json @@ -0,0 +1,57 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "SMALLINT" + } ], + "source" : { + "join" : { + "kind" : "ANTI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 8, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "content" : [ ] + } + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "SMALLINT" + } ], + "source" : { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "content" : [ ] + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($7, $8)], joinType=[anti])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testLeftEmptyFullJoin.json b/tests/calcite/testLeftEmptyFullJoin.json new file mode 100644 index 0000000..8f71bd2 --- /dev/null +++ b/tests/calcite/testLeftEmptyFullJoin.json @@ -0,0 +1,181 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testLeftEmptyInnerJoin.json b/tests/calcite/testLeftEmptyInnerJoin.json new file mode 100644 index 0000000..a3a1174 --- /dev/null +++ b/tests/calcite/testLeftEmptyInnerJoin.json @@ -0,0 +1,162 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN", "INTEGER", "VARCHAR" ], + "content" : [ ] + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testLeftEmptyLeftJoin.json b/tests/calcite/testLeftEmptyLeftJoin.json new file mode 100644 index 0000000..ab20416 --- /dev/null +++ b/tests/calcite/testLeftEmptyLeftJoin.json @@ -0,0 +1,162 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN", "INTEGER", "VARCHAR" ], + "content" : [ ] + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testLeftEmptyRightJoin.json b/tests/calcite/testLeftEmptyRightJoin.json new file mode 100644 index 0000000..7aee8c3 --- /dev/null +++ b/tests/calcite/testLeftEmptyRightJoin.json @@ -0,0 +1,181 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testLeftEmptySemiJoin.json b/tests/calcite/testLeftEmptySemiJoin.json new file mode 100644 index 0000000..440577f --- /dev/null +++ b/tests/calcite/testLeftEmptySemiJoin.json @@ -0,0 +1,57 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "SMALLINT" + } ], + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 8, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "content" : [ ] + } + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "SMALLINT" + } ], + "source" : { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "content" : [ ] + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($7, $8)], joinType=[semi])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testLeftOuterJoinSimplificationToInner.json b/tests/calcite/testLeftOuterJoinSimplificationToInner.json new file mode 100644 index 0000000..9f3f5b5 --- /dev/null +++ b/tests/calcite/testLeftOuterJoinSimplificationToInner.json @@ -0,0 +1,181 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 6, + "type" : "TIMESTAMP" + } ], + "type" : "TIMESTAMP" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 10, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($7, 100)])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[CAST($2):INTEGER], ENAME=[CAST($3):VARCHAR(20)], JOB=[CAST($4):VARCHAR(10)], MGR=[$5], HIREDATE=[CAST($6):TIMESTAMP(0)], SAL=[CAST($7):INTEGER], COMM=[CAST($8):INTEGER], DEPTNO0=[CAST($9):INTEGER], SLACKER=[CAST($10):BOOLEAN])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testMaxReuseDistinctAttrWithMixedOptionality.json b/tests/calcite/testMaxReuseDistinctAttrWithMixedOptionality.json new file mode 100644 index 0000000..83b3cd8 --- /dev/null +++ b/tests/calcite/testMaxReuseDistinctAttrWithMixedOptionality.json @@ -0,0 +1,244 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[MAX($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT($0)], EXPR$2=[MAX($0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testMergeFilter.json b/tests/calcite/testMergeFilter.json new file mode 100644 index 0000000..4572937 --- /dev/null +++ b/tests/calcite/testMergeFilter.json @@ -0,0 +1,102 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(NAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$1])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testMergeIntersect.json b/tests/calcite/testMergeIntersect.json new file mode 100644 index 0000000..946cf7e --- /dev/null +++ b/tests/calcite/testMergeIntersect.json @@ -0,0 +1,318 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "intersect" : [ { + "intersect" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + }, { + "intersect" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } ], + "help" : [ "LogicalIntersect(all=[false])\n LogicalIntersect(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalIntersect(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testMergeJoinFilter.json b/tests/calcite/testMergeJoinFilter.json new file mode 100644 index 0000000..0f3acdc --- /dev/null +++ b/tests/calcite/testMergeJoinFilter.json @@ -0,0 +1,152 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], ENAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalProject(DEPTNO=[$9], ENAME=[$1])\n LogicalJoin(condition=[AND(=($7, $9), =($9, 10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], ENAME=[$1])\n LogicalProject(DEPTNO=[$9], ENAME=[$1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testMergeMinus.json b/tests/calcite/testMergeMinus.json new file mode 100644 index 0000000..8e35f6b --- /dev/null +++ b/tests/calcite/testMergeMinus.json @@ -0,0 +1,324 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "except" : [ { + "distinct" : { + "except" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, { + "distinct" : { + "except" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalMinus(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testMergeUnionAll.json b/tests/calcite/testMergeUnionAll.json new file mode 100644 index 0000000..aae0f1d --- /dev/null +++ b/tests/calcite/testMergeUnionAll.json @@ -0,0 +1,318 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "union" : [ { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + }, { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } ], + "help" : [ "LogicalUnion(all=[true])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testMergeUnionDistinct.json b/tests/calcite/testMergeUnionDistinct.json new file mode 100644 index 0000000..996e9e8 --- /dev/null +++ b/tests/calcite/testMergeUnionDistinct.json @@ -0,0 +1,324 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "union" : [ { + "distinct" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, { + "distinct" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalUnion(all=[false])\n LogicalUnion(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalUnion(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testMergeUnionMixed2.json b/tests/calcite/testMergeUnionMixed2.json new file mode 100644 index 0000000..ea5990a --- /dev/null +++ b/tests/calcite/testMergeUnionMixed2.json @@ -0,0 +1,322 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "union" : [ { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, { + "distinct" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalUnion(all=[false])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalUnion(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testMinReuseDistinctAttrWithMixedOptionality.json b/tests/calcite/testMinReuseDistinctAttrWithMixedOptionality.json new file mode 100644 index 0000000..b5e73fc --- /dev/null +++ b/tests/calcite/testMinReuseDistinctAttrWithMixedOptionality.json @@ -0,0 +1,244 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[MIN($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT($0)], EXPR$2=[MIN($0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testMinusMergeRule.json b/tests/calcite/testMinusMergeRule.json new file mode 100644 index 0000000..4fab3ef --- /dev/null +++ b/tests/calcite/testMinusMergeRule.json @@ -0,0 +1,562 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "except" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "except" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "except" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "except" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } ] + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + }, { + "except" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "except" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } ] + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } ], + "help" : [ "LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalMinus(all=[true])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalMinus(all=[true])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalMinus(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0], EXPR$2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalMinus(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0], EXPR$2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalMinus(all=[true])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalMinus(all=[true])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testMultipleDistinctWithGrouping.json b/tests/calcite/testMultipleDistinctWithGrouping.json new file mode 100644 index 0000000..a7f2812 --- /dev/null +++ b/tests/calcite/testMultipleDistinctWithGrouping.json @@ -0,0 +1,619 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "AVG", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "IS NOT DISTINCT FROM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "IS NOT DISTINCT FROM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "AVG", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[AVG(DISTINCT $1)], EXPR$3=[SUM(DISTINCT $0)])\n LogicalProject(SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$0], EXPR$1=[$1], EXPR$2=[$3], EXPR$3=[$5])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$2=[AVG($1)])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$3=[SUM($0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(SAL=[$0])\n LogicalProject(SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testNoOversimplificationBelowIsNull.json b/tests/calcite/testNoOversimplificationBelowIsNull.json new file mode 100644 index 0000000..554800c --- /dev/null +++ b/tests/calcite/testNoOversimplificationBelowIsNull.json @@ -0,0 +1,203 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NULL", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NULL", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "NULL", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NULL(OR(AND(=($0, 1), =($3, 1)), AND(=($0, null), =($3, 1))))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NULL(OR(AND(=($0, 1), =($3, 1)), AND(null, =($3, 1))))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testOrAlwaysTrue.json b/tests/calcite/testOrAlwaysTrue.json new file mode 100644 index 0000000..bb8769d --- /dev/null +++ b/tests/calcite/testOrAlwaysTrue.json @@ -0,0 +1,217 @@ +{ + "schemas" : [ { + "name" : "EMPNULLABLES", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$7])\n LogicalFilter(condition=[OR(IS NULL($5), IS NOT NULL($5))])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$7])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testOrAlwaysTrue2.json b/tests/calcite/testOrAlwaysTrue2.json new file mode 100644 index 0000000..11b255f --- /dev/null +++ b/tests/calcite/testOrAlwaysTrue2.json @@ -0,0 +1,217 @@ +{ + "schemas" : [ { + "name" : "EMPNULLABLES", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$7])\n LogicalFilter(condition=[OR(IS NOT NULL($5), IS NULL($5))])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$7])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testOversimplifiedCaseStatement.json b/tests/calcite/testOversimplifiedCaseStatement.json new file mode 100644 index 0000000..b193821 --- /dev/null +++ b/tests/calcite/testOversimplifiedCaseStatement.json @@ -0,0 +1,194 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "/", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(>($3, 0), >(CASE(>($3, 0), /($7, $3), null:INTEGER), 1))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(>($3, 0), CASE(>($3, 0), >(/($7, $3), 1), false))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testProjectAggregateMerge.json b/tests/calcite/testProjectAggregateMerge.json new file mode 100644 index 0000000..da95205 --- /dev/null +++ b/tests/calcite/testProjectAggregateMerge.json @@ -0,0 +1,231 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[+($1, $3)])\n LogicalAggregate(group=[{0, 1}], MS=[MIN($2)], SS=[SUM($2)])\n LogicalProject(JOB=[$2], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject($f0=[+($1, $2)])\n LogicalAggregate(group=[{0, 1}], SS=[SUM($2)])\n LogicalProject(JOB=[$2], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testProjectAggregateMergeSum0.json b/tests/calcite/testProjectAggregateMergeSum0.json new file mode 100644 index 0000000..a0e0181 --- /dev/null +++ b/tests/calcite/testProjectAggregateMergeSum0.json @@ -0,0 +1,143 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalProject(SS0=[CASE(IS NOT NULL($0), CAST($0):INTEGER NOT NULL, 0)])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], agg#0=[$SUM0($0)])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testProjectAggregateMergeSum0AndSum.json b/tests/calcite/testProjectAggregateMergeSum0AndSum.json new file mode 100644 index 0000000..225b404 --- /dev/null +++ b/tests/calcite/testProjectAggregateMergeSum0AndSum.json @@ -0,0 +1,182 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "*", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "*", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "$SUM0", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[*($0, 2)], SS0=[CASE(IS NOT NULL($0), CAST($0):INTEGER NOT NULL, 0)])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject($f0=[*($0, 2)], $f1=[$1])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)], agg#1=[$SUM0($0)])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testProjectCorrelateTransposeRuleAntiCorrelate.json b/tests/calcite/testProjectCorrelateTransposeRuleAntiCorrelate.json new file mode 100644 index 0000000..0f44287 --- /dev/null +++ b/tests/calcite/testProjectCorrelateTransposeRuleAntiCorrelate.json @@ -0,0 +1,104 @@ +{ + "schemas" : [ ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "CHAR" + } ], + "source" : { + "correlate" : [ { + "values" : { + "schema" : [ "CHAR", "CHAR" ], + "content" : [ [ { + "operator" : "_ISO-8859-1'1'", + "operand" : [ ], + "type" : "CHAR" + }, { + "operator" : "_ISO-8859-1'2'", + "operand" : [ ], + "type" : "CHAR" + } ] ] + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "CHAR" + }, { + "column" : 0, + "type" : "CHAR" + } ], + "source" : { + "values" : { + "schema" : [ "CHAR", "CHAR" ], + "content" : [ [ { + "operator" : "_ISO-8859-1'1'", + "operand" : [ ], + "type" : "CHAR" + }, { + "operator" : "_ISO-8859-1'2'", + "operand" : [ ], + "type" : "CHAR" + } ] ] + } + } + } + } ] + } + } + }, { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "CHAR" + } ], + "source" : { + "values" : { + "schema" : [ "CHAR", "CHAR" ], + "content" : [ [ { + "operator" : "_ISO-8859-1'1'", + "operand" : [ ], + "type" : "CHAR" + }, { + "operator" : "_ISO-8859-1'2'", + "operand" : [ ], + "type" : "CHAR" + } ] ] + } + } + } + }, { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "CHAR" + }, { + "column" : 0, + "type" : "CHAR" + } ], + "source" : { + "values" : { + "schema" : [ "CHAR", "CHAR" ], + "content" : [ [ { + "operator" : "_ISO-8859-1'1'", + "operand" : [ ], + "type" : "CHAR" + }, { + "operator" : "_ISO-8859-1'2'", + "operand" : [ ], + "type" : "CHAR" + } ] ] + } + } + } + } + } + } ] + } ], + "help" : [ "LogicalProject(f=[$0])\n LogicalCorrelate(correlation=[$cor0], joinType=[anti], requiredColumns=[{0}])\n LogicalValues(tuples=[[{ '1', '2' }]])\n LogicalProject(f3=[$0], $f1=[$cor0.f])\n LogicalValues(tuples=[[{ '1', '2' }]])\n", "LogicalCorrelate(correlation=[$cor0], joinType=[anti], requiredColumns=[{0}])\n LogicalProject(f=[$0])\n LogicalValues(tuples=[[{ '1', '2' }]])\n LogicalProject\n LogicalProject(f3=[$0], $f1=[$cor0.f])\n LogicalValues(tuples=[[{ '1', '2' }]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testProjectCorrelateTransposeRuleLeftCorrelate.json b/tests/calcite/testProjectCorrelateTransposeRuleLeftCorrelate.json new file mode 100644 index 0000000..52d344b --- /dev/null +++ b/tests/calcite/testProjectCorrelateTransposeRuleLeftCorrelate.json @@ -0,0 +1,281 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "correlate" : [ { + "scan" : 0 + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BOOLEAN" + } ], + "source" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } ] + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalProject(EMPNO=[$0], $f0=[$2])\n LogicalCorrelate(correlation=[$cor2], joinType=[left], requiredColumns=[{1}])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject($f0=[$0])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor2.DEPTNO, $0)])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testProjectCorrelateTransposeRuleSemiCorrelate.json b/tests/calcite/testProjectCorrelateTransposeRuleSemiCorrelate.json new file mode 100644 index 0000000..9868d89 --- /dev/null +++ b/tests/calcite/testProjectCorrelateTransposeRuleSemiCorrelate.json @@ -0,0 +1,104 @@ +{ + "schemas" : [ ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "CHAR" + } ], + "source" : { + "correlate" : [ { + "values" : { + "schema" : [ "CHAR", "CHAR" ], + "content" : [ [ { + "operator" : "_ISO-8859-1'1'", + "operand" : [ ], + "type" : "CHAR" + }, { + "operator" : "_ISO-8859-1'2'", + "operand" : [ ], + "type" : "CHAR" + } ] ] + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "CHAR" + }, { + "column" : 0, + "type" : "CHAR" + } ], + "source" : { + "values" : { + "schema" : [ "CHAR", "CHAR" ], + "content" : [ [ { + "operator" : "_ISO-8859-1'1'", + "operand" : [ ], + "type" : "CHAR" + }, { + "operator" : "_ISO-8859-1'2'", + "operand" : [ ], + "type" : "CHAR" + } ] ] + } + } + } + } ] + } + } + }, { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "CHAR" + } ], + "source" : { + "values" : { + "schema" : [ "CHAR", "CHAR" ], + "content" : [ [ { + "operator" : "_ISO-8859-1'1'", + "operand" : [ ], + "type" : "CHAR" + }, { + "operator" : "_ISO-8859-1'2'", + "operand" : [ ], + "type" : "CHAR" + } ] ] + } + } + } + }, { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "CHAR" + }, { + "column" : 0, + "type" : "CHAR" + } ], + "source" : { + "values" : { + "schema" : [ "CHAR", "CHAR" ], + "content" : [ [ { + "operator" : "_ISO-8859-1'1'", + "operand" : [ ], + "type" : "CHAR" + }, { + "operator" : "_ISO-8859-1'2'", + "operand" : [ ], + "type" : "CHAR" + } ] ] + } + } + } + } + } + } ] + } ], + "help" : [ "LogicalProject(f=[$0])\n LogicalCorrelate(correlation=[$cor0], joinType=[semi], requiredColumns=[{0}])\n LogicalValues(tuples=[[{ '1', '2' }]])\n LogicalProject(f3=[$0], $f1=[$cor0.f])\n LogicalValues(tuples=[[{ '1', '2' }]])\n", "LogicalCorrelate(correlation=[$cor0], joinType=[semi], requiredColumns=[{0}])\n LogicalProject(f=[$0])\n LogicalValues(tuples=[[{ '1', '2' }]])\n LogicalProject\n LogicalProject(f3=[$0], $f1=[$cor0.f])\n LogicalValues(tuples=[[{ '1', '2' }]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testProjectFilterTransposeRuleOnEmptyRowType.json b/tests/calcite/testProjectFilterTransposeRuleOnEmptyRowType.json new file mode 100644 index 0000000..e0794b3 --- /dev/null +++ b/tests/calcite/testProjectFilterTransposeRuleOnEmptyRowType.json @@ -0,0 +1,66 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "TINYINT" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[scott, EMP]])\n", "LogicalProject\n LogicalFilter(condition=[=($0, 20)])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[scott, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testProjectJoinRemove1.json b/tests/calcite/testProjectJoinRemove1.json new file mode 100644 index 0000000..241391b --- /dev/null +++ b/tests/calcite/testProjectJoinRemove1.json @@ -0,0 +1,102 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$7], DEPTNO0=[$11])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$7], DEPTNO0=[$9])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testProjectJoinRemove10.json b/tests/calcite/testProjectJoinRemove10.json new file mode 100644 index 0000000..21452bf --- /dev/null +++ b/tests/calcite/testProjectJoinRemove10.json @@ -0,0 +1,64 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testProjectJoinRemove4.json b/tests/calcite/testProjectJoinRemove4.json new file mode 100644 index 0000000..15b6724 --- /dev/null +++ b/tests/calcite/testProjectJoinRemove4.json @@ -0,0 +1,58 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testProjectJoinRemove7.json b/tests/calcite/testProjectJoinRemove7.json new file mode 100644 index 0000000..5be942b --- /dev/null +++ b/tests/calcite/testProjectJoinRemove7.json @@ -0,0 +1,58 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$9])\n LogicalJoin(condition=[=($9, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testProjectJoinTransposeItem.json b/tests/calcite/testProjectJoinTransposeItem.json new file mode 100644 index 0000000..67558de --- /dev/null +++ b/tests/calcite/testProjectJoinTransposeItem.json @@ -0,0 +1,206 @@ +{ + "schemas" : [ { + "name" : "CUSTOMER", + "fields" : [ "C_NATIONKEY" ], + "types" : [ "ANY" ], + "strategy" : [ "NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "ITEM", + "operand" : [ { + "column" : 0, + "type" : "ANY" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "ANY" + }, { + "operator" : "ITEM", + "operand" : [ { + "column" : 2, + "type" : "ANY" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "ANY" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "ANY" + }, { + "column" : 3, + "type" : "ANY" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "ANY" + }, { + "operator" : "ITEM", + "operand" : [ { + "column" : 0, + "type" : "ANY" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "ANY" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "ANY" + }, { + "operator" : "ITEM", + "operand" : [ { + "column" : 0, + "type" : "ANY" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "ANY" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "ANY" + }, { + "column" : 3, + "type" : "ANY" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "ANY" + }, { + "column" : 2, + "type" : "ANY" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "ANY" + }, { + "operator" : "ITEM", + "operand" : [ { + "column" : 0, + "type" : "ANY" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "ANY" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "ANY" + }, { + "operator" : "ITEM", + "operand" : [ { + "column" : 0, + "type" : "ANY" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "ANY" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "ANY" + }, { + "operator" : "ITEM", + "operand" : [ { + "column" : 0, + "type" : "ANY" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "ANY" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "ANY" + }, { + "operator" : "ITEM", + "operand" : [ { + "column" : 0, + "type" : "ANY" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "ANY" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[ITEM($0, 0)], EXPR$1=[ITEM($2, 0)])\n LogicalJoin(condition=[=($1, $3)], joinType=[left])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$3])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalProject($f1=[$1], EXPR$0=[ITEM($0, 0)])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n LogicalProject($f1=[$1], EXPR$0=[ITEM($0, 0)])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testProjectSetOpTranspose.json b/tests/calcite/testProjectSetOpTranspose.json new file mode 100644 index 0000000..7dede2d --- /dev/null +++ b/tests/calcite/testProjectSetOpTranspose.json @@ -0,0 +1,216 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "error" : "Not implemented: SUM" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "error" : "Not implemented: SUM" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } ], + "help" : [ "LogicalProject(JOB=[$2], EXPR$1=[SUM(+($5, 100)) OVER (PARTITION BY $7)])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(JOB=[$0], EXPR$1=[SUM($2) OVER (PARTITION BY $1)])\n LogicalUnion(all=[true])\n LogicalProject(JOB=[$2], DEPTNO=[$7], EXPR$0=[+($5, 100)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$2], DEPTNO=[$7], EXPR$0=[+($5, 100)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullAggregateThroughUnion.json b/tests/calcite/testPullAggregateThroughUnion.json new file mode 100644 index 0000000..d008c60 --- /dev/null +++ b/tests/calcite/testPullAggregateThroughUnion.json @@ -0,0 +1,470 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullAggregateThroughUnion2.json b/tests/calcite/testPullAggregateThroughUnion2.json new file mode 100644 index 0000000..d008c60 --- /dev/null +++ b/tests/calcite/testPullAggregateThroughUnion2.json @@ -0,0 +1,470 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullAggregateThroughUnionAndAddProjects.json b/tests/calcite/testPullAggregateThroughUnionAndAddProjects.json new file mode 100644 index 0000000..bc5e1e4 --- /dev/null +++ b/tests/calcite/testPullAggregateThroughUnionAndAddProjects.json @@ -0,0 +1,470 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalProject(JOB=[$2], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$2], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullAggregateThroughUnionWithAlias.json b/tests/calcite/testPullAggregateThroughUnionWithAlias.json new file mode 100644 index 0000000..994572d --- /dev/null +++ b/tests/calcite/testPullAggregateThroughUnionWithAlias.json @@ -0,0 +1,572 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], C=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$0], C=[$1])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{2, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$2], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullConstantIntoFilter.json b/tests/calcite/testPullConstantIntoFilter.json new file mode 100644 index 0000000..d1f3f3a --- /dev/null +++ b/tests/calcite/testPullConstantIntoFilter.json @@ -0,0 +1,215 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "operator" : "15", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>(+($7, 5), $0)])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>(15, $0)])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullConstantIntoJoin.json b/tests/calcite/testPullConstantIntoJoin.json new file mode 100644 index 0000000..c1a10a7 --- /dev/null +++ b/tests/calcite/testPullConstantIntoJoin.json @@ -0,0 +1,243 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullConstantIntoJoin2.json b/tests/calcite/testPullConstantIntoJoin2.json new file mode 100644 index 0000000..dbb2a21 --- /dev/null +++ b/tests/calcite/testPullConstantIntoJoin2.json @@ -0,0 +1,326 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "15", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "15", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$10], NAME=[$11])\n LogicalJoin(condition=[AND(=($0, $10), =($9, $12))], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[10], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[10], NAME=[$11])\n LogicalJoin(condition=[=($9, 15)], joinType=[inner])\n LogicalProject(EMPNO=[10], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, 10)])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[10], NAME=[$1], $f2=[15])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullConstantIntoProject.json b/tests/calcite/testPullConstantIntoProject.json new file mode 100644 index 0000000..898d8a8 --- /dev/null +++ b/tests/calcite/testPullConstantIntoProject.json @@ -0,0 +1,101 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$7], EXPR$1=[+($7, 1)], EXPR$2=[+($0, $7)])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[10], EXPR$1=[11], EXPR$2=[+($0, 10)])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFrom.json b/tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFrom.json new file mode 100644 index 0000000..555c086 --- /dev/null +++ b/tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFrom.json @@ -0,0 +1,155 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$7], EXPR$1=[+($7, 1)], EXPR$2=[+($0, $7)])\n LogicalFilter(condition=[OR(AND(IS NULL($7), IS NULL(10)), IS TRUE(=($7, 10)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[10], EXPR$1=[11], EXPR$2=[+($0, 10)])\n LogicalFilter(condition=[OR(AND(IS NULL($7), IS NULL(10)), IS TRUE(=($7, 10)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json b/tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json new file mode 100644 index 0000000..901acc6 --- /dev/null +++ b/tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json @@ -0,0 +1,125 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(MGR=[$3], DEPTNO=[$7])\n LogicalFilter(condition=[OR(AND(IS NULL($3), IS NULL(null:INTEGER)), IS TRUE(=($3, null)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(MGR=[null:INTEGER], DEPTNO=[$7])\n LogicalFilter(condition=[OR(AND(IS NULL($3), IS NULL(null:INTEGER)), IS TRUE(=($3, null)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughAggregateAllConst.json b/tests/calcite/testPullConstantThroughAggregateAllConst.json new file mode 100644 index 0000000..9d63b42 --- /dev/null +++ b/tests/calcite/testPullConstantThroughAggregateAllConst.json @@ -0,0 +1,222 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(EXPR$0=[4], EXPR$1=[+(2, 3)], FIVE=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[+(2, 3)], EXPR$2=[$1])\n LogicalAggregate(group=[{0}], EXPR$2=[MAX($1)])\n LogicalProject(EXPR$0=[4], FIVE=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughAggregateAllLiterals.json b/tests/calcite/testPullConstantThroughAggregateAllLiterals.json new file mode 100644 index 0000000..7542dc7 --- /dev/null +++ b/tests/calcite/testPullConstantThroughAggregateAllLiterals.json @@ -0,0 +1,222 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(EXPR$0=[4], EXPR$1=[+(2, 3)], $f2=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[+(2, 3)], EXPR$2=[$1])\n LogicalAggregate(group=[{0}], EXPR$2=[MAX($1)])\n LogicalProject(EXPR$0=[4], $f2=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughAggregateConstGroupBy.json b/tests/calcite/testPullConstantThroughAggregateConstGroupBy.json new file mode 100644 index 0000000..ef36f4b --- /dev/null +++ b/tests/calcite/testPullConstantThroughAggregateConstGroupBy.json @@ -0,0 +1,218 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(EXPR$0=[4], EXPR$1=[+(2, 3)], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[+(2, 3)], EXPR$2=[$1])\n LogicalAggregate(group=[{0}], EXPR$2=[MAX($1)])\n LogicalProject(EXPR$0=[4], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughAggregatePermuted.json b/tests/calcite/testPullConstantThroughAggregatePermuted.json new file mode 100644 index 0000000..0a407bc --- /dev/null +++ b/tests/calcite/testPullConstantThroughAggregatePermuted.json @@ -0,0 +1,304 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "42", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "operator" : "42", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "42", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "42", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], EXPR$1=[$4])\n LogicalAggregate(group=[{0, 1, 2, 3}], EXPR$1=[MAX($4)])\n LogicalProject(DEPTNO=[$7], FOUR=[4], TWO_PLUS_THREE=[+(2, 3)], DEPTNO42=[+($7, 42)], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(DEPTNO=[$7], DEPTNO42=[+($7, 42)], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughAggregatePermutedConstFirst.json b/tests/calcite/testPullConstantThroughAggregatePermutedConstFirst.json new file mode 100644 index 0000000..d33c0af --- /dev/null +++ b/tests/calcite/testPullConstantThroughAggregatePermutedConstFirst.json @@ -0,0 +1,186 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$1], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(FOUR=[4], DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughAggregatePermutedConstGroupBy.json b/tests/calcite/testPullConstantThroughAggregatePermutedConstGroupBy.json new file mode 100644 index 0000000..1725adc --- /dev/null +++ b/tests/calcite/testPullConstantThroughAggregatePermutedConstGroupBy.json @@ -0,0 +1,202 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "operator" : "42", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "24", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "operator" : "42", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "24", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$1], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject($f0=[+(42, 24)], DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughAggregateSimpleNonNullable.json b/tests/calcite/testPullConstantThroughAggregateSimpleNonNullable.json new file mode 100644 index 0000000..fc63bfc --- /dev/null +++ b/tests/calcite/testPullConstantThroughAggregateSimpleNonNullable.json @@ -0,0 +1,186 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(DEPTNO=[$7], FOUR=[4], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughConstLast.json b/tests/calcite/testPullConstantThroughConstLast.json new file mode 100644 index 0000000..944342b --- /dev/null +++ b/tests/calcite/testPullConstantThroughConstLast.json @@ -0,0 +1,186 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(DEPTNO=[$7], FOUR=[4], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughUnion.json b/tests/calcite/testPullConstantThroughUnion.json new file mode 100644 index 0000000..037968c --- /dev/null +++ b/tests/calcite/testPullConstantThroughUnion.json @@ -0,0 +1,91 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "union" : [ { + "project" : { + "target" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } ] + }, { + "project" : { + "target" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } ], + "help" : [ "LogicalUnion(all=[true])\n LogicalProject(EXPR$0=[2], DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[2], DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[2], DEPTNO=[$0], JOB=[$1])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughUnion3.json b/tests/calcite/testPullConstantThroughUnion3.json new file mode 100644 index 0000000..e3d0fb2 --- /dev/null +++ b/tests/calcite/testPullConstantThroughUnion3.json @@ -0,0 +1,81 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "union" : [ { + "project" : { + "target" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + }, { + "project" : { + "target" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } ], + "help" : [ "LogicalUnion(all=[true])\n LogicalProject(EXPR$0=[2], EXPR$1=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[2], EXPR$1=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[2], EXPR$1=[3])\n LogicalUnion(all=[true])\n LogicalProject(EXPR$0=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullFilterThroughAggregate.json b/tests/calcite/testPullFilterThroughAggregate.json new file mode 100644 index 0000000..82f780e --- /dev/null +++ b/tests/calcite/testPullFilterThroughAggregate.json @@ -0,0 +1,248 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "5000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "operator" : "5000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "5000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1, 2}])\n LogicalFilter(condition=[>($1, 5000)])\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalFilter(condition=[>($1, 5000)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullFilterThroughAggregateGroupingSets.json b/tests/calcite/testPullFilterThroughAggregateGroupingSets.json new file mode 100644 index 0000000..696f19d --- /dev/null +++ b/tests/calcite/testPullFilterThroughAggregateGroupingSets.json @@ -0,0 +1,420 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "5000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "operator" : "5000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "5000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "operator" : "5000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1, 2}, {0, 1}, {0}, {}]])\n LogicalFilter(condition=[>($1, 5000)])\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1, 2}, {0, 1}, {0}, {}]])\n LogicalFilter(condition=[>($1, 5000)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPullNull.json b/tests/calcite/testPullNull.json new file mode 100644 index 0000000..a26a6e5 --- /dev/null +++ b/tests/calcite/testPullNull.json @@ -0,0 +1,170 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 7), =($0, 10), IS NULL($3), =($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[10], ENAME=[$1], JOB=[$2], MGR=[null:INTEGER], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[7], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 7), =($0, 10), IS NULL($3))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAboveFiltersIntoInnerJoinCondition.json b/tests/calcite/testPushAboveFiltersIntoInnerJoinCondition.json new file mode 100644 index 0000000..37ca316 --- /dev/null +++ b/tests/calcite/testPushAboveFiltersIntoInnerJoinCondition.json @@ -0,0 +1,180 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalFilter(condition=[>($0, $5)])\n LogicalJoin(condition=[AND(=($0, $9), >($0, $5))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalJoin(condition=[AND(=($0, $9), >($0, $5))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateFunctionsThroughJoin.json b/tests/calcite/testPushAggregateFunctionsThroughJoin.json new file mode 100644 index 0000000..4561391 --- /dev/null +++ b/tests/calcite/testPushAggregateFunctionsThroughJoin.json @@ -0,0 +1,443 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "BIGINT" + }, { + "column" : 7, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "BIGINT" + }, { + "column" : 7, + "type" : "BIGINT" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "column" : 8, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + }, { + "operator" : "*", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "column" : 8, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(JOB=[$0], MIN_SAL=[$2], MIN_DEPTNO=[$3], SUM_SAL_PLUS=[+($4, 1)], MAX_SAL=[$5], SUM_SAL_2=[$4], COUNT_SAL=[$6], COUNT_MGR=[$7])\n LogicalAggregate(group=[{2, 10}], MIN_SAL=[MIN($5)], MIN_DEPTNO=[MIN($7)], SUM_SAL_2=[SUM($5)], MAX_SAL=[MAX($5)], COUNT_SAL=[COUNT()], COUNT_MGR=[COUNT($3)])\n LogicalJoin(condition=[=($2, $10)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(JOB=[$0], MIN_SAL=[$2], MIN_DEPTNO=[$3], SUM_SAL_PLUS=[+($4, 1)], MAX_SAL=[$5], SUM_SAL_2=[$4], COUNT_SAL=[$6], COUNT_MGR=[$7])\n LogicalProject(JOB=[$0], NAME=[$7], MIN_SAL=[$1], MIN_DEPTNO=[$2], $f9=[CAST(*($3, $8)):INTEGER NOT NULL], MAX_SAL=[$4], $f10=[*($5, $8)], $f11=[*($6, $8)])\n LogicalJoin(condition=[=($0, $7)], joinType=[inner])\n LogicalAggregate(group=[{2}], MIN_SAL=[MIN($5)], MIN_DEPTNO=[MIN($7)], SUM_SAL_2=[SUM($5)], MAX_SAL=[MAX($5)], COUNT_SAL=[COUNT()], COUNT_MGR=[COUNT($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateSumNoGroup.json b/tests/calcite/testPushAggregateSumNoGroup.json new file mode 100644 index 0000000..84b6d78 --- /dev/null +++ b/tests/calcite/testPushAggregateSumNoGroup.json @@ -0,0 +1,370 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "*", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 0, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "*", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalJoin(condition=[=($2, $10)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{}], EXPR$0=[$SUM0($0)])\n LogicalProject($f4=[*($1, $3)])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{2}], EXPR$0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateSumThroughJoin.json b/tests/calcite/testPushAggregateSumThroughJoin.json new file mode 100644 index 0000000..008c697 --- /dev/null +++ b/tests/calcite/testPushAggregateSumThroughJoin.json @@ -0,0 +1,470 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(JOB=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{2, 10}], EXPR$1=[SUM($5)])\n LogicalJoin(condition=[=($2, $10)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(JOB=[$0], EXPR$1=[$2])\n LogicalProject(JOB=[$0], NAME=[$2], $f4=[CAST(*($1, $3)):INTEGER NOT NULL])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{2}], EXPR$1=[SUM($5)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateSumThroughJoinAfterAggregateReduce.json b/tests/calcite/testPushAggregateSumThroughJoinAfterAggregateReduce.json new file mode 100644 index 0000000..96322bd --- /dev/null +++ b/tests/calcite/testPushAggregateSumThroughJoinAfterAggregateReduce.json @@ -0,0 +1,743 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CAST", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "$SUM0", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CAST", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($5)])\n LogicalJoin(condition=[=($2, $10)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EXPR$0=[CASE(=($1, 0), null:INTEGER, $0)])\n LogicalAggregate(group=[{}], EXPR$0=[$SUM0($0)], agg#1=[$SUM0($1)])\n LogicalProject($f5=[CAST(*($1, $4)):INTEGER NOT NULL], $f6=[*($2, $4)])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalAggregate(group=[{2}], EXPR$0=[$SUM0($5)], agg#1=[COUNT()])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateSumWithoutGroupKeyThroughJoin.json b/tests/calcite/testPushAggregateSumWithoutGroupKeyThroughJoin.json new file mode 100644 index 0000000..bcf7acd --- /dev/null +++ b/tests/calcite/testPushAggregateSumWithoutGroupKeyThroughJoin.json @@ -0,0 +1,675 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CAST", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CAST", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($5)])\n LogicalJoin(condition=[=($2, $10)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject($f4=[CAST(*($1, $3)):INTEGER])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{2}], EXPR$0=[SUM($5)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoin1.json b/tests/calcite/testPushAggregateThroughJoin1.json new file mode 100644 index 0000000..8fce89f --- /dev/null +++ b/tests/calcite/testPushAggregateThroughJoin1.json @@ -0,0 +1,399 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + }, { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{2, 10}])\n LogicalJoin(condition=[=($2, $10)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoin2.json b/tests/calcite/testPushAggregateThroughJoin2.json new file mode 100644 index 0000000..a1fe16d --- /dev/null +++ b/tests/calcite/testPushAggregateThroughJoin2.json @@ -0,0 +1,941 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 13, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 13, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 14, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "TIMESTAMP" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{2, 11}])\n LogicalJoin(condition=[AND(=($2, $11), =($9, $12))], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0, 2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[inner])\n LogicalAggregate(group=[{2, 9}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoin4.json b/tests/calcite/testPushAggregateThroughJoin4.json new file mode 100644 index 0000000..1648704 --- /dev/null +++ b/tests/calcite/testPushAggregateThroughJoin4.json @@ -0,0 +1,172 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{7}])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoin5.json b/tests/calcite/testPushAggregateThroughJoin5.json new file mode 100644 index 0000000..50acfe7 --- /dev/null +++ b/tests/calcite/testPushAggregateThroughJoin5.json @@ -0,0 +1,199 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], DEPTNO0=[$1])\n LogicalAggregate(group=[{7, 9}])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], DEPTNO0=[$1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoin6.json b/tests/calcite/testPushAggregateThroughJoin6.json new file mode 100644 index 0000000..490da35 --- /dev/null +++ b/tests/calcite/testPushAggregateThroughJoin6.json @@ -0,0 +1,438 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CAST", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CAST", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($9)])\n LogicalJoin(condition=[=($5, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject($f3=[CAST(*($1, $2)):INTEGER])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{5}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoin7.json b/tests/calcite/testPushAggregateThroughJoin7.json new file mode 100644 index 0000000..0de612b --- /dev/null +++ b/tests/calcite/testPushAggregateThroughJoin7.json @@ -0,0 +1,388 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "ANY_VALUE", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "ANY_VALUE", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[ANY_VALUE($9)])\n LogicalJoin(condition=[=($5, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[ANY_VALUE($1)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoin8.json b/tests/calcite/testPushAggregateThroughJoin8.json new file mode 100644 index 0000000..c9a7224 --- /dev/null +++ b/tests/calcite/testPushAggregateThroughJoin8.json @@ -0,0 +1,388 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SINGLE_VALUE", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SINGLE_VALUE", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SINGLE_VALUE($9)])\n LogicalJoin(condition=[=($5, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SINGLE_VALUE($1)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoinDistinct.json b/tests/calcite/testPushAggregateThroughJoinDistinct.json new file mode 100644 index 0000000..d3fb6cb --- /dev/null +++ b/tests/calcite/testPushAggregateThroughJoinDistinct.json @@ -0,0 +1,314 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 9, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{9}], SUM_SAL=[SUM($5)], C=[COUNT()])\n LogicalJoin(condition=[=($2, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$3], SUM_SAL=[$1], C=[$2])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalAggregate(group=[{2}], SUM_SAL=[SUM($5)], C=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoinOnEmptyLogicalValues.json b/tests/calcite/testPushAggregateThroughJoinOnEmptyLogicalValues.json new file mode 100644 index 0000000..e92afc3 --- /dev/null +++ b/tests/calcite/testPushAggregateThroughJoinOnEmptyLogicalValues.json @@ -0,0 +1,433 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] + } + } + } + } + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 0, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] + } + } + } + } + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], VOLUME=[COUNT()], C1_SUM_SAL=[SUM($0)])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalProject(SAL=[$5], ENAME=[$1])\n LogicalValues(tuples=[[]])\n LogicalProject(ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], VOLUME=[$SUM0($0)], C1_SUM_SAL=[SUM($1)])\n LogicalProject(VOLUME=[$3], $f4=[CAST(*($1, $3)):INTEGER])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$0])\n LogicalProject(SAL=[$5], ENAME=[$1])\n LogicalValues(tuples=[[]])\n LogicalAggregate(group=[{0}], VOLUME=[COUNT()])\n LogicalProject(ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoinWithUniqueInput.json b/tests/calcite/testPushAggregateThroughJoinWithUniqueInput.json new file mode 100644 index 0000000..6fffaad --- /dev/null +++ b/tests/calcite/testPushAggregateThroughJoinWithUniqueInput.json @@ -0,0 +1,774 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "TIMESTAMP" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 6, + "type" : "TIMESTAMP" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "TIMESTAMP" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 14, + "type" : "TIMESTAMP" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "TIMESTAMP" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 15, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 9, + "type" : "TIMESTAMP" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "TIMESTAMP" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "TIMESTAMP" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 6, + "type" : "TIMESTAMP" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "TIMESTAMP" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 6, + "type" : "TIMESTAMP" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "TIMESTAMP" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "TIMESTAMP" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 9, + "type" : "TIMESTAMP" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "TIMESTAMP" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(JOB=[$0], MGR0=[$2], DEPTNO=[$1], HIREDATE1=[$3], COMM1=[$4])\n LogicalAggregate(group=[{2, 7, 9}], HIREDATE1=[MAX($11)], COMM1=[SUM($12)])\n LogicalJoin(condition=[=($5, $10)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{3, 5}], HIREDATE1=[MAX($4)], COMM1=[SUM($6)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(JOB=[$0], MGR0=[$2], DEPTNO=[$1], HIREDATE1=[$3], COMM1=[$4])\n LogicalAggregate(group=[{0, 1, 2}], HIREDATE1=[MAX($3)], COMM1=[SUM($4)])\n LogicalProject(JOB=[$0], DEPTNO=[$2], MGR=[$4], HIREDATE1=[$6], $f8=[CAST(*($3, $7)):INTEGER NOT NULL])\n LogicalJoin(condition=[=($1, $5)], joinType=[inner])\n LogicalAggregate(group=[{2, 5, 7}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{3, 5}], HIREDATE1=[MAX($4)], COMM1=[SUM($6)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin1.json b/tests/calcite/testPushAggregateThroughOuterJoin1.json new file mode 100644 index 0000000..f7b2e7a --- /dev/null +++ b/tests/calcite/testPushAggregateThroughOuterJoin1.json @@ -0,0 +1,641 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "TIMESTAMP" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{1}])\n LogicalJoin(condition=[=($2, $10)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin12.json b/tests/calcite/testPushAggregateThroughOuterJoin12.json new file mode 100644 index 0000000..bff3d7e --- /dev/null +++ b/tests/calcite/testPushAggregateThroughOuterJoin12.json @@ -0,0 +1,615 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[=($2, $10)], joinType=[right])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin13.json b/tests/calcite/testPushAggregateThroughOuterJoin13.json new file mode 100644 index 0000000..cc56464 --- /dev/null +++ b/tests/calcite/testPushAggregateThroughOuterJoin13.json @@ -0,0 +1,615 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[=($2, $10)], joinType=[full])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[full])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin14.json b/tests/calcite/testPushAggregateThroughOuterJoin14.json new file mode 100644 index 0000000..dd05548 --- /dev/null +++ b/tests/calcite/testPushAggregateThroughOuterJoin14.json @@ -0,0 +1,390 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 14, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 14, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalProject(MGR=[$1], MGR0=[$0])\n LogicalProject(MGR0=[$1], MGR=[$0])\n LogicalAggregate(group=[{3, 12}])\n LogicalJoin(condition=[=($3, $12)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(MGR=[$1], MGR0=[$0])\n LogicalProject(MGR0=[$1], MGR=[$0])\n LogicalAggregate(group=[{0, 1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[full])\n LogicalAggregate(group=[{3}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{3}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin15.json b/tests/calcite/testPushAggregateThroughOuterJoin15.json new file mode 100644 index 0000000..b3abbee --- /dev/null +++ b/tests/calcite/testPushAggregateThroughOuterJoin15.json @@ -0,0 +1,686 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 14, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 13, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "TIMESTAMP" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{1, 12}])\n LogicalJoin(condition=[=($2, $11)], joinType=[full])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 3}])\n LogicalJoin(condition=[=($1, $2)], joinType=[full])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{2, 3}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin16.json b/tests/calcite/testPushAggregateThroughOuterJoin16.json new file mode 100644 index 0000000..5d06c6f --- /dev/null +++ b/tests/calcite/testPushAggregateThroughOuterJoin16.json @@ -0,0 +1,915 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "TIMESTAMP" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[AND(=($2, $11), =($9, $12))], joinType=[full])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[full])\n LogicalAggregate(group=[{2, 9}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin2.json b/tests/calcite/testPushAggregateThroughOuterJoin2.json new file mode 100644 index 0000000..93b7880 --- /dev/null +++ b/tests/calcite/testPushAggregateThroughOuterJoin2.json @@ -0,0 +1,634 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{10}])\n LogicalJoin(condition=[=($2, $11)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{1}])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1, 2}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin3.json b/tests/calcite/testPushAggregateThroughOuterJoin3.json new file mode 100644 index 0000000..3d66d61 --- /dev/null +++ b/tests/calcite/testPushAggregateThroughOuterJoin3.json @@ -0,0 +1,686 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 14, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 13, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "TIMESTAMP" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{1, 12}])\n LogicalJoin(condition=[=($2, $11)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 3}])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{2, 3}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin4.json b/tests/calcite/testPushAggregateThroughOuterJoin4.json new file mode 100644 index 0000000..ac27434 --- /dev/null +++ b/tests/calcite/testPushAggregateThroughOuterJoin4.json @@ -0,0 +1,394 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[=($2, $10)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(JOB=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin5.json b/tests/calcite/testPushAggregateThroughOuterJoin5.json new file mode 100644 index 0000000..bae1df4 --- /dev/null +++ b/tests/calcite/testPushAggregateThroughOuterJoin5.json @@ -0,0 +1,615 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{10}])\n LogicalJoin(condition=[=($2, $10)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin6.json b/tests/calcite/testPushAggregateThroughOuterJoin6.json new file mode 100644 index 0000000..35512dc --- /dev/null +++ b/tests/calcite/testPushAggregateThroughOuterJoin6.json @@ -0,0 +1,399 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + }, { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{2, 10}])\n LogicalJoin(condition=[=($2, $10)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin7.json b/tests/calcite/testPushAggregateThroughOuterJoin7.json new file mode 100644 index 0000000..1f7b152 --- /dev/null +++ b/tests/calcite/testPushAggregateThroughOuterJoin7.json @@ -0,0 +1,915 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "TIMESTAMP" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[AND(=($2, $11), =($9, $12))], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalAggregate(group=[{2, 9}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin8.json b/tests/calcite/testPushAggregateThroughOuterJoin8.json new file mode 100644 index 0000000..817b738 --- /dev/null +++ b/tests/calcite/testPushAggregateThroughOuterJoin8.json @@ -0,0 +1,915 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 11, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "TIMESTAMP" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{11}])\n LogicalJoin(condition=[AND(=($2, $11), =($9, $12))], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalAggregate(group=[{2, 9}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin9.json b/tests/calcite/testPushAggregateThroughOuterJoin9.json new file mode 100644 index 0000000..8f00d9f --- /dev/null +++ b/tests/calcite/testPushAggregateThroughOuterJoin9.json @@ -0,0 +1,941 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 13, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 13, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 14, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "TIMESTAMP" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'A'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{2, 11}])\n LogicalJoin(condition=[AND(=($2, $11), =($9, $12))], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0, 2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalAggregate(group=[{2, 9}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAvgGroupingSetsThroughUnion.json b/tests/calcite/testPushAvgGroupingSetsThroughUnion.json new file mode 100644 index 0000000..1951111 --- /dev/null +++ b/tests/calcite/testPushAvgGroupingSetsThroughUnion.json @@ -0,0 +1,364 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "AVG", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "AVG", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[AVG($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[AVG($2)])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushAvgThroughUnion.json b/tests/calcite/testPushAvgThroughUnion.json new file mode 100644 index 0000000..65e7af0 --- /dev/null +++ b/tests/calcite/testPushAvgThroughUnion.json @@ -0,0 +1,320 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "AVG", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "AVG", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[AVG($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[AVG($1)])\n LogicalUnion(all=[true])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushBoolAndBoolOrThroughUnion.json b/tests/calcite/testPushBoolAndBoolOrThroughUnion.json new file mode 100644 index 0000000..b5e5cdb --- /dev/null +++ b/tests/calcite/testPushBoolAndBoolOrThroughUnion.json @@ -0,0 +1,692 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "MOD", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "MOD", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "BOOL_AND", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + }, { + "operator" : "BOOL_OR", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "MOD", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "MOD", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "MOD", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "BOOL_AND", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + }, { + "operator" : "BOOL_OR", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "MOD", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "MOD", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "BOOL_AND", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + }, { + "operator" : "BOOL_OR", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "MOD", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "BOOL_AND", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + }, { + "operator" : "BOOL_OR", + "operand" : [ { + "column" : 3, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "MOD", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "BOOL_AND", + "operand" : [ { + "column" : 3, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + }, { + "operator" : "BOOL_OR", + "operand" : [ { + "column" : 3, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "MOD", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "MOD", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "BOOL_AND", + "operand" : [ { + "column" : 3, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + }, { + "operator" : "BOOL_OR", + "operand" : [ { + "column" : 3, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "MOD", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($1)])\n LogicalUnion(all=[true])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($1)])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($1)])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushCountFilterThroughUnion.json b/tests/calcite/testPushCountFilterThroughUnion.json new file mode 100644 index 0000000..6784b99 --- /dev/null +++ b/tests/calcite/testPushCountFilterThroughUnion.json @@ -0,0 +1,809 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'CLERK'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'CLERK'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'CLERK'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'CLERK'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'CLERK'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'CLERK'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'CLERK'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'CLERK'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'CLERK'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'CLERK'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT() FILTER $1])\n LogicalProject(DEPTNO=[$7], $f1=[=($2, 'CLERK')])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT() FILTER $1])\n LogicalProject(DEPTNO=[$7], $f1=[=($2, 'CLERK')])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT() FILTER $1])\n LogicalProject(DEPTNO=[$7], $f1=[=($2, 'CLERK')])\n LogicalFilter(condition=[>($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushCountNullableGroupingSetsThroughUnion.json b/tests/calcite/testPushCountNullableGroupingSetsThroughUnion.json new file mode 100644 index 0000000..a8d10b3 --- /dev/null +++ b/tests/calcite/testPushCountNullableGroupingSetsThroughUnion.json @@ -0,0 +1,660 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[$SUM0($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushCountNullableThroughUnion.json b/tests/calcite/testPushCountNullableThroughUnion.json new file mode 100644 index 0000000..b494f6e --- /dev/null +++ b/tests/calcite/testPushCountNullableThroughUnion.json @@ -0,0 +1,552 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushCountStarGroupingSetsThroughUnion.json b/tests/calcite/testPushCountStarGroupingSetsThroughUnion.json new file mode 100644 index 0000000..5cb43fa --- /dev/null +++ b/tests/calcite/testPushCountStarGroupingSetsThroughUnion.json @@ -0,0 +1,615 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT()])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[$SUM0($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushCountStarThroughUnion.json b/tests/calcite/testPushCountStarThroughUnion.json new file mode 100644 index 0000000..e9bedac --- /dev/null +++ b/tests/calcite/testPushCountStarThroughUnion.json @@ -0,0 +1,507 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(ENAME=[$1])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushFilterPastAgg.json b/tests/calcite/testPushFilterPastAgg.json new file mode 100644 index 0000000..d199f27 --- /dev/null +++ b/tests/calcite/testPushFilterPastAgg.json @@ -0,0 +1,206 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'Charlie'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'Charlie'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'Charlie'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(DNAME=[$0], C=[$1])\n LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalAggregate(group=[{0}], C=[COUNT()])\n LogicalProject(DNAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DNAME=[$0], C=[$1])\n LogicalAggregate(group=[{0}], C=[COUNT()])\n LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalProject(DNAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushFilterPastAggFour.json b/tests/calcite/testPushFilterPastAggFour.json new file mode 100644 index 0000000..4a03ab6 --- /dev/null +++ b/tests/calcite/testPushFilterPastAggFour.json @@ -0,0 +1,442 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "_ISO-8859-1'12'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "_ISO-8859-1'12'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "12", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "12", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "12", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "12", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{1}], EXPR$1=[$SUM0($2)])\n LogicalFilter(condition=[>($0, CAST('12'):INTEGER NOT NULL)])\n LogicalAggregate(group=[{5, 7}], EXPR$1=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{1}], EXPR$1=[$SUM0($2)])\n LogicalAggregate(group=[{5, 7}], EXPR$1=[COUNT()])\n LogicalFilter(condition=[>($5, 12)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushFilterPastAggTwo.json b/tests/calcite/testPushFilterPastAggTwo.json new file mode 100644 index 0000000..f415968 --- /dev/null +++ b/tests/calcite/testPushFilterPastAggTwo.json @@ -0,0 +1,325 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'c'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "OR", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'z'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'b'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'b'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'z'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'c'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'b'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'c'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'b'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalProject(C1=[$0])\n LogicalFilter(condition=[AND(>($0, 'c'), OR(>($1, 30), <($0, 'z')))])\n LogicalAggregate(group=[{0}], C2=[COUNT()])\n LogicalProject(C1=[$1])\n LogicalFilter(condition=[>($1, 'b')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(C1=[$0])\n LogicalFilter(condition=[OR(>($1, 30), <($0, 'z'))])\n LogicalAggregate(group=[{0}], C2=[COUNT()])\n LogicalFilter(condition=[>($0, 'c')])\n LogicalProject(C1=[$1])\n LogicalFilter(condition=[>($1, 'b')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushFilterPastAggWithGroupingSets2.json b/tests/calcite/testPushFilterPastAggWithGroupingSets2.json new file mode 100644 index 0000000..ceeb102 --- /dev/null +++ b/tests/calcite/testPushFilterPastAggWithGroupingSets2.json @@ -0,0 +1,250 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'Charlie'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'Charlie'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'Charlie'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(DNAME=[$0], DDEPTNO=[$1], C=[$2])\n LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]], C=[COUNT()])\n LogicalProject(DNAME=[$1], DDEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DNAME=[$0], DDEPTNO=[$1], C=[$2])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]], C=[COUNT()])\n LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalProject(DNAME=[$1], DDEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushFilterPastProject.json b/tests/calcite/testPushFilterPastProject.json new file mode 100644 index 0000000..25f1973 --- /dev/null +++ b/tests/calcite/testPushFilterPastProject.json @@ -0,0 +1,246 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "column" : 4, + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : ">", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "column" : 4, + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : ">", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 4, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(NAME=[$1])\n LogicalJoin(condition=[$4], joinType=[right])\n LogicalProject(DEPTNO=[$0], NAME=[$1], DEPTNO0=[$2], NAME0=[$3], $f4=[>($2, 10)])\n LogicalJoin(condition=[$4], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$1])\n LogicalJoin(condition=[true], joinType=[right])\n LogicalProject(DEPTNO=[$0], NAME=[$1], DEPTNO0=[$2], NAME0=[$3], $f4=[>($2, 10)])\n LogicalProject(DEPTNO=[$0], NAME=[$1], DEPTNO0=[CAST($2):INTEGER], NAME0=[CAST($3):VARCHAR(10)], $f2=[CAST($4):BOOLEAN])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[>($0, 10)])\n LogicalFilter(condition=[>($0, 10)])\n LogicalFilter(condition=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushFilterSemijoin.json b/tests/calcite/testPushFilterSemijoin.json new file mode 100644 index 0000000..f8df5c8 --- /dev/null +++ b/tests/calcite/testPushFilterSemijoin.json @@ -0,0 +1,108 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 10, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "DECIMAL" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 10, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "DECIMAL" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[AND(=($0, $10), =($8, 100))], joinType=[semi])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, EMP]])\n", "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $10)], joinType=[semi])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalFilter(condition=[=($5, 100)])\n LogicalTableScan(table=[[scott, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushFilterThroughSemiJoin.json b/tests/calcite/testPushFilterThroughSemiJoin.json new file mode 100644 index 0000000..4f0c585 --- /dev/null +++ b/tests/calcite/testPushFilterThroughSemiJoin.json @@ -0,0 +1,131 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "<=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[<=($0, 10)])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalFilter(condition=[<=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushFilterWithIsNotDistinctFromPastJoin.json b/tests/calcite/testPushFilterWithIsNotDistinctFromPastJoin.json new file mode 100644 index 0000000..67d9b10 --- /dev/null +++ b/tests/calcite/testPushFilterWithIsNotDistinctFromPastJoin.json @@ -0,0 +1,227 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT DISTINCT FROM", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalFilter(condition=[OR(AND(IS NULL($1), IS NULL($10)), IS TRUE(=($1, $10)))])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[AND(=($7, $16), IS NOT DISTINCT FROM($1, $10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushJoinCondDownToProject.json b/tests/calcite/testPushJoinCondDownToProject.json new file mode 100644 index 0000000..97bff64 --- /dev/null +++ b/tests/calcite/testPushJoinCondDownToProject.json @@ -0,0 +1,211 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "TIMESTAMP" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], DEPTNO0=[$9])\n LogicalFilter(condition=[=(+($0, 10), *($9, 2))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], DEPTNO0=[$9])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$3], ENAME=[$4], JOB=[$5], MGR=[$6], HIREDATE=[$7], SAL=[$8], COMM=[$9], DEPTNO0=[$10], SLACKER=[$11])\n LogicalJoin(condition=[=($2, $12)], joinType=[inner])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[*($7, 2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushJoinThroughUnionOnLeft.json b/tests/calcite/testPushJoinThroughUnionOnLeft.json new file mode 100644 index 0000000..36b9134 --- /dev/null +++ b/tests/calcite/testPushJoinThroughUnionOnLeft.json @@ -0,0 +1,207 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "scan" : 0 + } + } + }, { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "scan" : 0 + } + } + } ] + } + } + } ], + "help" : [ "LogicalProject(SAL=[$5])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalUnion(all=[true])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushJoinThroughUnionOnRight.json b/tests/calcite/testPushJoinThroughUnionOnRight.json new file mode 100644 index 0000000..f586a0d --- /dev/null +++ b/tests/calcite/testPushJoinThroughUnionOnRight.json @@ -0,0 +1,207 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } ], + "help" : [ "LogicalProject(SAL=[$5])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalUnion(all=[true])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushMaxNullableGroupingSetsThroughUnion.json b/tests/calcite/testPushMaxNullableGroupingSetsThroughUnion.json new file mode 100644 index 0000000..78f2588 --- /dev/null +++ b/tests/calcite/testPushMaxNullableGroupingSetsThroughUnion.json @@ -0,0 +1,660 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MAX($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MAX($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushMaxNullableThroughUnion.json b/tests/calcite/testPushMaxNullableThroughUnion.json new file mode 100644 index 0000000..ff30efd --- /dev/null +++ b/tests/calcite/testPushMaxNullableThroughUnion.json @@ -0,0 +1,552 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushMinGroupingSetsThroughUnion.json b/tests/calcite/testPushMinGroupingSetsThroughUnion.json new file mode 100644 index 0000000..c5aef1a --- /dev/null +++ b/tests/calcite/testPushMinGroupingSetsThroughUnion.json @@ -0,0 +1,660 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MIN($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MIN($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MIN($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MIN($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushMinThroughUnion.json b/tests/calcite/testPushMinThroughUnion.json new file mode 100644 index 0000000..d64984c --- /dev/null +++ b/tests/calcite/testPushMinThroughUnion.json @@ -0,0 +1,552 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastFilter.json b/tests/calcite/testPushProjectPastFilter.json new file mode 100644 index 0000000..c36860e --- /dev/null +++ b/tests/calcite/testPushProjectPastFilter.json @@ -0,0 +1,150 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "UPPER", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'FOO'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "UPPER", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'FOO'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[+($0, $7)])\n LogicalFilter(condition=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[+($0, $4)])\n LogicalFilter(condition=[AND(=($2, *(10, $3)), =(UPPER($1), 'FOO'))])\n LogicalProject(EMPNO=[$0], ENAME=[$1], SAL=[$5], COMM=[$6], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastFilter2.json b/tests/calcite/testPushProjectPastFilter2.json new file mode 100644 index 0000000..cced41a --- /dev/null +++ b/tests/calcite/testPushProjectPastFilter2.json @@ -0,0 +1,218 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[0])\n LogicalFilter(condition=[CASE(<($3, 10), true, false)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[0])\n LogicalFilter(condition=[<($0, 10)])\n LogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastFilter3b.json b/tests/calcite/testPushProjectPastFilter3b.json new file mode 100644 index 0000000..e5ee51f --- /dev/null +++ b/tests/calcite/testPushProjectPastFilter3b.json @@ -0,0 +1,204 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "UPPER", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'FOO'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "TIMESTAMP" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "column" : 7, + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "UPPER", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'FOO'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(X=[+($0, $7)], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(X=[$8], ENAME=[$0], JOB=[$1], MGR=[$2], HIREDATE=[$3], SAL=[$4], COMM=[$5], SLACKER=[$6])\n LogicalFilter(condition=[$7])\n LogicalProject(ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], $f7=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))], $f8=[+($0, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastFilter3c.json b/tests/calcite/testPushProjectPastFilter3c.json new file mode 100644 index 0000000..f2bc116 --- /dev/null +++ b/tests/calcite/testPushProjectPastFilter3c.json @@ -0,0 +1,201 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "UPPER", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'FOO'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "TIMESTAMP" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "UPPER", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'FOO'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(X=[+($0, $7)], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(X=[$7], ENAME=[$0], JOB=[$1], MGR=[$2], HIREDATE=[$3], SAL=[$4], COMM=[$5], SLACKER=[$6])\n LogicalFilter(condition=[AND(=($4, *(10, $5)), =(UPPER($0), 'FOO'))])\n LogicalProject(ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], $f7=[+($0, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastFullJoin.json b/tests/calcite/testPushProjectPastFullJoin.json new file mode 100644 index 0000000..daa9897 --- /dev/null +++ b/tests/calcite/testPushProjectPastFullJoin.json @@ -0,0 +1,393 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "BONUS", + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "<", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalJoin(condition=[=($1, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE($1, 11, $2)])\n LogicalJoin(condition=[=($0, $3)], joinType=[full])\n LogicalProject(ENAME=[$1], EXPR$0=[<($5, 11)], EXPR$1=[*(-1, $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastFullJoinStrong.json b/tests/calcite/testPushProjectPastFullJoinStrong.json new file mode 100644 index 0000000..1bc7981 --- /dev/null +++ b/tests/calcite/testPushProjectPastFullJoinStrong.json @@ -0,0 +1,383 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "BONUS", + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalJoin(condition=[=($1, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[full])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastInnerJoin.json b/tests/calcite/testPushProjectPastInnerJoin.json new file mode 100644 index 0000000..cdad70b --- /dev/null +++ b/tests/calcite/testPushProjectPastInnerJoin.json @@ -0,0 +1,387 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "BONUS", + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalJoin(condition=[=($1, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastInnerJoinStrong.json b/tests/calcite/testPushProjectPastInnerJoinStrong.json new file mode 100644 index 0000000..5cd74a7 --- /dev/null +++ b/tests/calcite/testPushProjectPastInnerJoinStrong.json @@ -0,0 +1,383 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "BONUS", + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalJoin(condition=[=($1, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastJoin.json b/tests/calcite/testPushProjectPastJoin.json new file mode 100644 index 0000000..097e15b --- /dev/null +++ b/tests/calcite/testPushProjectPastJoin.json @@ -0,0 +1,146 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "BONUS", + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "column" : 2, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[+($5, $12)])\n LogicalJoin(condition=[AND(=($1, $9), =($7, 10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[+($1, $4)])\n LogicalJoin(condition=[AND(=($0, $3), $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0], COMM=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastLeftJoin.json b/tests/calcite/testPushProjectPastLeftJoin.json new file mode 100644 index 0000000..73234b7 --- /dev/null +++ b/tests/calcite/testPushProjectPastLeftJoin.json @@ -0,0 +1,387 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "BONUS", + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalJoin(condition=[=($1, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastLeftJoinSwap.json b/tests/calcite/testPushProjectPastLeftJoinSwap.json new file mode 100644 index 0000000..8edfd6c --- /dev/null +++ b/tests/calcite/testPushProjectPastLeftJoinSwap.json @@ -0,0 +1,393 @@ +{ + "schemas" : [ { + "name" : "BONUS", + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "column" : 3, + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "<", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($9, 11), 11, *(-1, $9))])\n LogicalJoin(condition=[=($5, $0)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE($2, 11, $3)])\n LogicalJoin(condition=[=($1, $0)], joinType=[left])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$0=[<($5, 11)], EXPR$1=[*(-1, $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastLeftJoinSwapStrong.json b/tests/calcite/testPushProjectPastLeftJoinSwapStrong.json new file mode 100644 index 0000000..2ae418b --- /dev/null +++ b/tests/calcite/testPushProjectPastLeftJoinSwapStrong.json @@ -0,0 +1,383 @@ +{ + "schemas" : [ { + "name" : "BONUS", + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($9, 11), *(-1, $9), $9)])\n LogicalJoin(condition=[=($5, $0)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$2])\n LogicalJoin(condition=[=($1, $0)], joinType=[left])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastRightJoin.json b/tests/calcite/testPushProjectPastRightJoin.json new file mode 100644 index 0000000..94482eb --- /dev/null +++ b/tests/calcite/testPushProjectPastRightJoin.json @@ -0,0 +1,393 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "BONUS", + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "<", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalJoin(condition=[=($1, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE($1, 11, $2)])\n LogicalJoin(condition=[=($0, $3)], joinType=[right])\n LogicalProject(ENAME=[$1], EXPR$0=[<($5, 11)], EXPR$1=[*(-1, $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastRightJoinStrong.json b/tests/calcite/testPushProjectPastRightJoinStrong.json new file mode 100644 index 0000000..e48051d --- /dev/null +++ b/tests/calcite/testPushProjectPastRightJoinStrong.json @@ -0,0 +1,383 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "BONUS", + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalJoin(condition=[=($1, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastRightJoinSwap.json b/tests/calcite/testPushProjectPastRightJoinSwap.json new file mode 100644 index 0000000..82a2209 --- /dev/null +++ b/tests/calcite/testPushProjectPastRightJoinSwap.json @@ -0,0 +1,387 @@ +{ + "schemas" : [ { + "name" : "BONUS", + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($9, 11), 11, *(-1, $9))])\n LogicalJoin(condition=[=($5, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$2])\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastRightJoinSwapStrong.json b/tests/calcite/testPushProjectPastRightJoinSwapStrong.json new file mode 100644 index 0000000..5426444 --- /dev/null +++ b/tests/calcite/testPushProjectPastRightJoinSwapStrong.json @@ -0,0 +1,383 @@ +{ + "schemas" : [ { + "name" : "BONUS", + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "*", + "operand" : [ { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($9, 11), *(-1, $9), $9)])\n LogicalJoin(condition=[=($5, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$2])\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastSetOp.json b/tests/calcite/testPushProjectPastSetOp.json new file mode 100644 index 0000000..41a07a1 --- /dev/null +++ b/tests/calcite/testPushProjectPastSetOp.json @@ -0,0 +1,176 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + }, { + "union" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } ] + } ], + "help" : [ "LogicalProject(SAL=[$5])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalUnion(all=[true])\n LogicalProject(SAL=[$5])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(SAL=[$5])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectWithIsNotDistinctFromPastJoin.json b/tests/calcite/testPushProjectWithIsNotDistinctFromPastJoin.json new file mode 100644 index 0000000..d265b38 --- /dev/null +++ b/tests/calcite/testPushProjectWithIsNotDistinctFromPastJoin.json @@ -0,0 +1,284 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "BONUS", + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NOT DISTINCT FROM", + "operand" : [ { + "column" : 9, + "type" : "VARCHAR" + }, { + "column" : 14, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "||", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "||", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NOT DISTINCT FROM", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "column" : 2, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "||", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "||", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[+($5, $13)])\n LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($9, $14), =($7, 10))], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[||($1, $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0], JOB=[$1], SAL=[$2], COMM=[$3], $f4=[||($0, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[+($0, $3)])\n LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($1, $4), $2)], joinType=[inner])\n LogicalProject(SAL=[$5], $f9=[$9], EXPR$0=[=($7, 10)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[||($1, $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(COMM=[$3], $f4=[$4])\n LogicalProject(ENAME=[$0], JOB=[$1], SAL=[$2], COMM=[$3], $f4=[||($0, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectWithOverPastJoin1.json b/tests/calcite/testPushProjectWithOverPastJoin1.json new file mode 100644 index 0000000..8e171d0 --- /dev/null +++ b/tests/calcite/testPushProjectWithOverPastJoin1.json @@ -0,0 +1,156 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "BONUS", + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "error" : "Not implemented: COUNT" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "error" : "Not implemented: COUNT" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "column" : 4, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[+($5, $12)], EXPR$1=[COUNT($0) OVER (PARTITION BY $7)])\n LogicalJoin(condition=[AND(=($1, $9), =($7, 10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[+($2, $6)], EXPR$1=[COUNT($0) OVER (PARTITION BY $3)])\n LogicalJoin(condition=[AND(=($1, $5), $4)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], SAL=[$5], DEPTNO=[$7], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0], COMM=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectWithOverPastJoin2.json b/tests/calcite/testPushProjectWithOverPastJoin2.json new file mode 100644 index 0000000..c513508 --- /dev/null +++ b/tests/calcite/testPushProjectWithOverPastJoin2.json @@ -0,0 +1,156 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "BONUS", + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "error" : "Not implemented: COUNT" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "error" : "Not implemented: COUNT" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "column" : 2, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[+($5, $12)], EXPR$1=[COUNT($11) OVER (PARTITION BY $10)])\n LogicalJoin(condition=[AND(=($1, $9), =($7, 10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[+($1, $6)], EXPR$1=[COUNT($5) OVER (PARTITION BY $4)])\n LogicalJoin(condition=[AND(=($0, $3), $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0], JOB=[$1], SAL=[$2], COMM=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectWithOverPastJoin3.json b/tests/calcite/testPushProjectWithOverPastJoin3.json new file mode 100644 index 0000000..75f1463 --- /dev/null +++ b/tests/calcite/testPushProjectWithOverPastJoin3.json @@ -0,0 +1,171 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "BONUS", + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "error" : "Not implemented: SUM" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "error" : "Not implemented: SUM" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "column" : 2, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[+($5, $12)], EXPR$1=[SUM(+(+($11, $11), 100)) OVER (PARTITION BY $10)])\n LogicalJoin(condition=[AND(=($1, $9), =($7, 10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[+($1, $5)], EXPR$1=[SUM($6) OVER (PARTITION BY $4)])\n LogicalJoin(condition=[AND(=($0, $3), $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0], JOB=[$1], COMM=[$3], EXPR$0=[+(+($2, $2), 100)])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushSemiJoinConditions.json b/tests/calcite/testPushSemiJoinConditions.json new file mode 100644 index 0000000..4c3f8c4 --- /dev/null +++ b/tests/calcite/testPushSemiJoinConditions.json @@ -0,0 +1,193 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "TINYINT" + } ], + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 2, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 0, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 2, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "OR", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "TINYINT" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NOT DISTINCT FROM", + "operand" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 8, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT DISTINCT FROM", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[AND(OR(=($0, $2), AND(IS NULL($0), IS NULL($2))), OR(=($1, $3), AND(IS NULL($1), IS NULL($3))))], joinType=[semi])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($7, $8), IS NOT DISTINCT FROM($1, $9))], joinType=[semi])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushSemiJoinPastFilter.json b/tests/calcite/testPushSemiJoinPastFilter.json new file mode 100644 index 0000000..199d72c --- /dev/null +++ b/tests/calcite/testPushSemiJoinPastFilter.json @@ -0,0 +1,136 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'foo'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'foo'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } ], + "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($1, 'foo'))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalFilter(condition=[=($1, 'foo')])\n LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushSemiJoinPastJoinRuleLeft.json b/tests/calcite/testPushSemiJoinPastJoinRuleLeft.json new file mode 100644 index 0000000..69dceea --- /dev/null +++ b/tests/calcite/testPushSemiJoinPastJoinRuleLeft.json @@ -0,0 +1,170 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 0 + } + } + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($0, $11))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($0, $11)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($0, $9)], joinType=[semi])\n LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushSemiJoinPastJoinRuleRight.json b/tests/calcite/testPushSemiJoinPastJoinRuleRight.json new file mode 100644 index 0000000..287573c --- /dev/null +++ b/tests/calcite/testPushSemiJoinPastJoinRuleRight.json @@ -0,0 +1,170 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 1 + }, + "right" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($9, $18))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($9, $18)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalJoin(condition=[=($0, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushSemiJoinPastProject.json b/tests/calcite/testPushSemiJoinPastProject.json new file mode 100644 index 0000000..2f3494a --- /dev/null +++ b/tests/calcite/testPushSemiJoinPastProject.json @@ -0,0 +1,197 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "TRIM", + "operand" : [ { + "operator" : "BOTH", + "operand" : [ ], + "type" : "SYMBOL" + }, { + "operator" : "_ISO-8859-1' '", + "operand" : [ ], + "type" : "CHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "operator" : "*", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "TRIM", + "operand" : [ { + "operator" : "BOTH", + "operand" : [ ], + "type" : "SYMBOL" + }, { + "operator" : "_ISO-8859-1' '", + "operand" : [ ], + "type" : "CHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "operator" : "*", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } ], + "help" : [ "LogicalProject(ENAME=[$0], EXPR$1=[$1], EXPR$2=[$2], DEPTNO=[$3])\n LogicalFilter(condition=[=($3, $4)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(ENAME=[$1], EXPR$1=[TRIM(FLAG(BOTH), ' ', $2)], EXPR$2=[*($5, 2)], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(ENAME=[$0], EXPR$1=[$1], EXPR$2=[$2], DEPTNO=[$3])\n LogicalJoin(condition=[=($3, $4)], joinType=[inner], semiJoinDone=[true])\n LogicalProject(ENAME=[$1], EXPR$1=[TRIM(FLAG(BOTH), ' ', $2)], EXPR$2=[*($5, 2)], DEPTNO=[$7])\n LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushSumConstantGroupingSetsThroughUnion.json b/tests/calcite/testPushSumConstantGroupingSetsThroughUnion.json new file mode 100644 index 0000000..19a4a49 --- /dev/null +++ b/tests/calcite/testPushSumConstantGroupingSetsThroughUnion.json @@ -0,0 +1,684 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[$9])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushSumConstantThroughUnion.json b/tests/calcite/testPushSumConstantThroughUnion.json new file mode 100644 index 0000000..d632121 --- /dev/null +++ b/tests/calcite/testPushSumConstantThroughUnion.json @@ -0,0 +1,576 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[$9])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushSumCountStarGroupingSetsThroughUnion.json b/tests/calcite/testPushSumCountStarGroupingSetsThroughUnion.json new file mode 100644 index 0000000..a45b798 --- /dev/null +++ b/tests/calcite/testPushSumCountStarGroupingSetsThroughUnion.json @@ -0,0 +1,807 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "$SUM0", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)], EXPR$3=[COUNT()], EXPR$4=[MIN($0)], EXPR$5=[MAX($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)], EXPR$3=[$SUM0($3)], EXPR$4=[MIN($4)], EXPR$5=[MAX($5)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)], EXPR$3=[COUNT()], EXPR$4=[MIN($0)], EXPR$5=[MAX($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)], EXPR$3=[COUNT()], EXPR$4=[MIN($0)], EXPR$5=[MAX($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushSumCountStarThroughUnion.json b/tests/calcite/testPushSumCountStarThroughUnion.json new file mode 100644 index 0000000..21e89a1 --- /dev/null +++ b/tests/calcite/testPushSumCountStarThroughUnion.json @@ -0,0 +1,729 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "$SUM0", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT()], EXPR$3=[MIN($2)], EXPR$4=[MAX($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], DEPTNO=[$7])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[$SUM0($2)], EXPR$3=[MIN($3)], EXPR$4=[MAX($4)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT()], EXPR$3=[MIN($2)], EXPR$4=[MAX($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT()], EXPR$3=[MIN($2)], EXPR$4=[MAX($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushSumNullConstantGroupingSetsThroughUnion.json b/tests/calcite/testPushSumNullConstantGroupingSetsThroughUnion.json new file mode 100644 index 0000000..78cbb1d --- /dev/null +++ b/tests/calcite/testPushSumNullConstantGroupingSetsThroughUnion.json @@ -0,0 +1,684 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[$9])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushSumNullConstantThroughUnion.json b/tests/calcite/testPushSumNullConstantThroughUnion.json new file mode 100644 index 0000000..9378271 --- /dev/null +++ b/tests/calcite/testPushSumNullConstantThroughUnion.json @@ -0,0 +1,576 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[$9])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushSumNullableGroupingSetsThroughUnion.json b/tests/calcite/testPushSumNullableGroupingSetsThroughUnion.json new file mode 100644 index 0000000..a97ecb1 --- /dev/null +++ b/tests/calcite/testPushSumNullableGroupingSetsThroughUnion.json @@ -0,0 +1,660 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushSumNullableNOGBYThroughUnion.json b/tests/calcite/testPushSumNullableNOGBYThroughUnion.json new file mode 100644 index 0000000..4bec949 --- /dev/null +++ b/tests/calcite/testPushSumNullableNOGBYThroughUnion.json @@ -0,0 +1,444 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject(MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testPushSumNullableThroughUnion.json b/tests/calcite/testPushSumNullableThroughUnion.json new file mode 100644 index 0000000..cfd91ac --- /dev/null +++ b/tests/calcite/testPushSumNullableThroughUnion.json @@ -0,0 +1,552 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "TIMESTAMP" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceAggregateFunctionsByGroup.json b/tests/calcite/testReduceAggregateFunctionsByGroup.json new file mode 100644 index 0000000..a836cba --- /dev/null +++ b/tests/calcite/testReduceAggregateFunctionsByGroup.json @@ -0,0 +1,268 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "AVG", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "ANY_VALUE", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "FIRST_VALUE", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "LAST_VALUE", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalProject(SAL=[$0], SAL_MAX=[$2], SAL_MIN=[$3], SAL_AVG=[$4], SAL_VAL=[$5], SAL_FIRST=[$6], SAL_LAST=[$7])\n LogicalAggregate(group=[{0, 1}], SAL_MAX=[MAX($0)], SAL_MIN=[MIN($0)], SAL_AVG=[AVG($0)], SAL_VAL=[ANY_VALUE($0)], SAL_FIRST=[FIRST_VALUE($0)], SAL_LAST=[LAST_VALUE($0)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$0], SAL_MAX=[$0], SAL_MIN=[$0], SAL_AVG=[$0], SAL_VAL=[$0], SAL_FIRST=[$0], SAL_LAST=[$0])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceAllAggregateFunctions.json b/tests/calcite/testReduceAllAggregateFunctions.json new file mode 100644 index 0000000..2b77b87 --- /dev/null +++ b/tests/calcite/testReduceAllAggregateFunctions.json @@ -0,0 +1,479 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "STDDEV_POP", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "AVG", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "STDDEV_SAMP", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "VAR_POP", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "VAR_SAMP", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "POWER", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "operator" : "-", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "/", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "BIGINT" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + }, { + "operator" : "0.5", + "operand" : [ ], + "type" : "DECIMAL" + } ], + "type" : "DOUBLE" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "POWER", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "operator" : "-", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "/", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "BIGINT" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "BIGINT" + }, { + "operator" : "-", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "BIGINT" + }, { + "operator" : "0.5", + "operand" : [ ], + "type" : "DECIMAL" + } ], + "type" : "DOUBLE" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "operator" : "-", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "/", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "BIGINT" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "operator" : "-", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "/", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "BIGINT" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "BIGINT" + }, { + "operator" : "-", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "$SUM0", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[STDDEV_SAMP($1)], EXPR$4=[VAR_POP($1)], EXPR$5=[VAR_SAMP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[CAST(POWER(/(-($1, /(*($2, $2), $3)), $3), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[CAST(POWER(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1))), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$4=[CAST(/(-($1, /(*($2, $2), $3)), $3)):INTEGER NOT NULL], EXPR$5=[CAST(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1)))):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($2)], agg#1=[$SUM0($1)], agg#2=[COUNT()])\n LogicalProject(NAME=[$0], DEPTNO=[$1], $f2=[*($1, $1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceAverage.json b/tests/calcite/testReduceAverage.json new file mode 100644 index 0000000..a5dd797 --- /dev/null +++ b/tests/calcite/testReduceAverage.json @@ -0,0 +1,206 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "VARCHAR" + }, { + "operator" : "AVG", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[MAX($0)], EXPR$2=[AVG($1)], EXPR$3=[MIN($0)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[$0], EXPR$2=[CAST(/($1, $2)):INTEGER NOT NULL], EXPR$3=[$0])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1)], agg#1=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceAverageAndSumWithNoReduceStddevAndVar.json b/tests/calcite/testReduceAverageAndSumWithNoReduceStddevAndVar.json new file mode 100644 index 0000000..bfe3af3 --- /dev/null +++ b/tests/calcite/testReduceAverageAndSumWithNoReduceStddevAndVar.json @@ -0,0 +1,224 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "STDDEV_POP", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "AVG", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "VAR_POP", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "STDDEV_POP", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "$SUM0", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "VAR_POP", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[VAR_POP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[$4])\n LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], agg#1=[$SUM0($1)], agg#2=[COUNT()], EXPR$3=[VAR_POP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceAverageAndVarWithNoReduceStddev.json b/tests/calcite/testReduceAverageAndVarWithNoReduceStddev.json new file mode 100644 index 0000000..5ccd581 --- /dev/null +++ b/tests/calcite/testReduceAverageAndVarWithNoReduceStddev.json @@ -0,0 +1,298 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "STDDEV_POP", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "AVG", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "VAR_POP", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "operator" : "-", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "operator" : "/", + "operand" : [ { + "operator" : "*", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "BIGINT" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "STDDEV_POP", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "*", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[VAR_POP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[CAST(/(-($4, /(*($2, $2), $3)), $3)):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], agg#1=[SUM($1)], agg#2=[COUNT()], agg#3=[SUM($2)])\n LogicalProject(NAME=[$0], DEPTNO=[$1], $f2=[*($1, $1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceAverageWithNoReduceSum.json b/tests/calcite/testReduceAverageWithNoReduceSum.json new file mode 100644 index 0000000..deac8b2 --- /dev/null +++ b/tests/calcite/testReduceAverageWithNoReduceSum.json @@ -0,0 +1,206 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MAX", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "VARCHAR" + }, { + "operator" : "AVG", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[MAX($0)], EXPR$2=[AVG($1)], EXPR$3=[MIN($0)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[$0], EXPR$2=[CAST(/($1, $2)):INTEGER NOT NULL], EXPR$3=[$0])\n LogicalAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceCase.json b/tests/calcite/testReduceCase.json new file mode 100644 index 0000000..a367588 --- /dev/null +++ b/tests/calcite/testReduceCase.json @@ -0,0 +1,46 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "2.1", + "operand" : [ ], + "type" : "FLOAT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "FLOAT" + } ], + "type" : "FLOAT" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "FLOAT" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(NEWCOL=[CASE(false, 2.1:FLOAT, 1:FLOAT)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(NEWCOL=[1E0:FLOAT])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceCaseNullabilityChange.json b/tests/calcite/testReduceCaseNullabilityChange.json new file mode 100644 index 0000000..e2f0b9a --- /dev/null +++ b/tests/calcite/testReduceCaseNullabilityChange.json @@ -0,0 +1,88 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "IS NOT NULL", + "operand" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "operator" : "CAST", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(QX=[CASE(=($0, 1), 1, IS NOT NULL(1), 2, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(QX=[CAST(CASE(=($0, 1), 1, 2)):INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceCastAndConsts.json b/tests/calcite/testReduceCastAndConsts.json new file mode 100644 index 0000000..3bbf4e7 --- /dev/null +++ b/tests/calcite/testReduceCastAndConsts.json @@ -0,0 +1,140 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "CAST", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "/", + "operand" : [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "13", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "13", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=(CAST(+($0, /(10, 2))):INTEGER NOT NULL, 13)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=(+($0, 5), 13)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceCasts.json b/tests/calcite/testReduceCasts.json new file mode 100644 index 0000000..4e7f972 --- /dev/null +++ b/tests/calcite/testReduceCasts.json @@ -0,0 +1,325 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "CAST", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "CAST", + "operand" : [ { + "operator" : "CAST", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'Manager'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "TIMESTAMP" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "CAST", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "CAST", + "operand" : [ { + "operator" : "CAST", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'Manager'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "TIMESTAMP" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[CAST($1):VARCHAR(128) NOT NULL], EXPR$1=[CAST($2):INTEGER NOT NULL])\n LogicalFilter(condition=[=(CAST(CAST($4):VARCHAR(1) NOT NULL):VARCHAR(7) NOT NULL, 'Manager')])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$3], ENAME=[$4], JOB=[$5], MGR=[$6], HIREDATE=[$7], SAL=[$8], COMM=[$9], DEPTNO1=[$10], SLACKER=[$11])\n LogicalJoin(condition=[=($2, $12)], joinType=[inner])\n LogicalProject(DEPTNO=[$0], NAME=[$1], DEPTNO0=[CAST($0):INTEGER NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[CAST($7):INTEGER NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[CAST($1):VARCHAR(128) NOT NULL], EXPR$1=[$2])\n LogicalFilter(condition=[=(CAST(CAST($4):VARCHAR(1) NOT NULL):VARCHAR(7) NOT NULL, 'Manager')])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$3], ENAME=[$4], JOB=[$5], MGR=[$6], HIREDATE=[$7], SAL=[$8], COMM=[$9], DEPTNO1=[$10], SLACKER=[$11])\n LogicalJoin(condition=[=($2, $12)], joinType=[inner])\n LogicalProject(DEPTNO=[$0], NAME=[$1], DEPTNO0=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceCompositeInSubQuery.json b/tests/calcite/testReduceCompositeInSubQuery.json new file mode 100644 index 0000000..f4cde78 --- /dev/null +++ b/tests/calcite/testReduceCompositeInSubQuery.json @@ -0,0 +1,322 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "IN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "40", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "60", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "IN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($7, +(40, 60)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($7, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstants.json b/tests/calcite/testReduceConstants.json new file mode 100644 index 0000000..1a8be05 --- /dev/null +++ b/tests/calcite/testReduceConstants.json @@ -0,0 +1,340 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "6", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "ROW", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "8", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "ROW" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "8", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "8", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "-", + "operand" : [ { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "22", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "26", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "ROW", + "operand" : [ { + "operator" : "15", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "ROW" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[+(1, 2)], EXPR$1=[+($0, +(3, 4))], EXPR$2=[+(+(5, 6), $0)], EXPR$3=[null:INTEGER], EXPR$4=[CASE(IS NOT NULL(2), 2, null:INTEGER)], EXPR$5=[ROW(+(7, 8))])\n LogicalFilter(condition=[AND(=($0, +(7, 8)), =($0, +(8, 7)), =($0, CASE(IS NOT NULL(2), 2, null:INTEGER)))])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalJoin(condition=[=($0, $11)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, -(5, 5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[3], EXPR$1=[22], EXPR$2=[26], EXPR$3=[null:INTEGER], EXPR$4=[CAST(2):INTEGER], EXPR$5=[ROW(15)])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstants3.json b/tests/calcite/testReduceConstants3.json new file mode 100644 index 0000000..b3b755f --- /dev/null +++ b/tests/calcite/testReduceConstants3.json @@ -0,0 +1,131 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[OR(AND(IS NULL($3), IS NULL($12)), IS TRUE(=($3, $12)))])\n LogicalFilter(condition=[IS NULL($3)])\n LogicalJoin(condition=[=($3, $12)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[IS NULL($12)])\n LogicalFilter(condition=[IS NULL($3)])\n LogicalJoin(condition=[=($3, $12)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsCaseEquals.json b/tests/calcite/testReduceConstantsCaseEquals.json new file mode 100644 index 0000000..ababbf4 --- /dev/null +++ b/tests/calcite/testReduceConstantsCaseEquals.json @@ -0,0 +1,248 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[=(CASE(=($7, 20), 2, =($7, 10), 1, 3), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsCaseEquals2.json b/tests/calcite/testReduceConstantsCaseEquals2.json new file mode 100644 index 0000000..93c5749 --- /dev/null +++ b/tests/calcite/testReduceConstantsCaseEquals2.json @@ -0,0 +1,248 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[=(CASE(=($7, 20), 2, =($7, 10), 1, null:INTEGER), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsCaseEquals3.json b/tests/calcite/testReduceConstantsCaseEquals3.json new file mode 100644 index 0000000..9823bae --- /dev/null +++ b/tests/calcite/testReduceConstantsCaseEquals3.json @@ -0,0 +1,308 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "111", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "111", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "SEARCH", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "Sarg[10, 30]", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "SEARCH", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "Sarg[10, 30]", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[=(CASE(=($7, 30), 1, =($7, 20), 2, =($7, 10), 1, =($7, 30), 111, 0), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[SEARCH($7, Sarg[10, 30])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsDup.json b/tests/calcite/testReduceConstantsDup.json new file mode 100644 index 0000000..f894ef4 --- /dev/null +++ b/tests/calcite/testReduceConstantsDup.json @@ -0,0 +1,66 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "8", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR" ], + "content" : [ ] + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[AND(=($0, 7), =($0, 8))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsDup2.json b/tests/calcite/testReduceConstantsDup2.json new file mode 100644 index 0000000..ccd0def --- /dev/null +++ b/tests/calcite/testReduceConstantsDup2.json @@ -0,0 +1,145 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "8", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 7), =($7, 8), =($0, 10), IS NULL($3), =($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[10], ENAME=[$1], JOB=[$2], MGR=[null:INTEGER], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsDup3.json b/tests/calcite/testReduceConstantsDup3.json new file mode 100644 index 0000000..51da0d5 --- /dev/null +++ b/tests/calcite/testReduceConstantsDup3.json @@ -0,0 +1,63 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "<>", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "8", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[OR(<>($0, 7), <>($0, 8))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsDup3Null.json b/tests/calcite/testReduceConstantsDup3Null.json new file mode 100644 index 0000000..6124aed --- /dev/null +++ b/tests/calcite/testReduceConstantsDup3Null.json @@ -0,0 +1,75 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "<>", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "8", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(<>($3, 7), <>($3, 8))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsDupNot.json b/tests/calcite/testReduceConstantsDupNot.json new file mode 100644 index 0000000..661d055 --- /dev/null +++ b/tests/calcite/testReduceConstantsDupNot.json @@ -0,0 +1,67 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "NOT", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "8", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[NOT(AND(=($0, 7), =($0, 8)))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsDupNot2.json b/tests/calcite/testReduceConstantsDupNot2.json new file mode 100644 index 0000000..b104cc8 --- /dev/null +++ b/tests/calcite/testReduceConstantsDupNot2.json @@ -0,0 +1,78 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "NOT", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'foo'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "8", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[NOT(AND(=($0, 7), =($1, 'foo'), =($0, 8)))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsDupNot2Null.json b/tests/calcite/testReduceConstantsDupNot2Null.json new file mode 100644 index 0000000..5b2fbf9 --- /dev/null +++ b/tests/calcite/testReduceConstantsDupNot2Null.json @@ -0,0 +1,105 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "NOT", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "8", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "8", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "8", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[NOT(AND(=($3, 7), =($7, 8), =($3, 8)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IS NOT NULL($3), <>($7, 8))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsDupNotNull.json b/tests/calcite/testReduceConstantsDupNotNull.json new file mode 100644 index 0000000..9538912 --- /dev/null +++ b/tests/calcite/testReduceConstantsDupNotNull.json @@ -0,0 +1,79 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "NOT", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "8", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[NOT(AND(=($3, 7), =($3, 8)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsEliminatesFilter.json b/tests/calcite/testReduceConstantsEliminatesFilter.json new file mode 100644 index 0000000..7a3cc63 --- /dev/null +++ b/tests/calcite/testReduceConstantsEliminatesFilter.json @@ -0,0 +1,78 @@ +{ + "schemas" : [ ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalFilter(condition=[>(+(1, 2), +(3, null))])\n LogicalValues(tuples=[[{ 1, 2 }]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsIsNotNull.json b/tests/calcite/testReduceConstantsIsNotNull.json new file mode 100644 index 0000000..4287198 --- /dev/null +++ b/tests/calcite/testReduceConstantsIsNotNull.json @@ -0,0 +1,75 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[AND(=($0, 10), IS NOT NULL($0))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsIsNull.json b/tests/calcite/testReduceConstantsIsNull.json new file mode 100644 index 0000000..7972e47 --- /dev/null +++ b/tests/calcite/testReduceConstantsIsNull.json @@ -0,0 +1,62 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[AND(=($0, 10), IS NULL($0))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsNegated.json b/tests/calcite/testReduceConstantsNegated.json new file mode 100644 index 0000000..b8847f5 --- /dev/null +++ b/tests/calcite/testReduceConstantsNegated.json @@ -0,0 +1,70 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NOT", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[AND(=($0, 10), NOT(=($0, 10)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsNegatedInverted.json b/tests/calcite/testReduceConstantsNegatedInverted.json new file mode 100644 index 0000000..508fba0 --- /dev/null +++ b/tests/calcite/testReduceConstantsNegatedInverted.json @@ -0,0 +1,66 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[AND(>($0, 10), <=($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsNull.json b/tests/calcite/testReduceConstantsNull.json new file mode 100644 index 0000000..7323653 --- /dev/null +++ b/tests/calcite/testReduceConstantsNull.json @@ -0,0 +1,101 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NULL", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(N=[$0])\n LogicalFilter(condition=[IS NULL($0)])\n LogicalProject(N=[$0])\n LogicalFilter(condition=[AND(IS NULL($0), IS NULL($0))])\n LogicalProject(N=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(N=[$0])\n LogicalProject(N=[$0])\n LogicalProject(N=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsNullEqualsOne.json b/tests/calcite/testReduceConstantsNullEqualsOne.json new file mode 100644 index 0000000..a18641c --- /dev/null +++ b/tests/calcite/testReduceConstantsNullEqualsOne.json @@ -0,0 +1,154 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] + } + } + } + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[=(null, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsProjectNullable.json b/tests/calcite/testReduceConstantsProjectNullable.json new file mode 100644 index 0000000..11df9fa --- /dev/null +++ b/tests/calcite/testReduceConstantsProjectNullable.json @@ -0,0 +1,69 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "CAST", + "operand" : [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(MGR=[$3])\n LogicalFilter(condition=[=($3, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(MGR=[CAST(10):INTEGER])\n LogicalFilter(condition=[=($3, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsRequiresExecutor.json b/tests/calcite/testReduceConstantsRequiresExecutor.json new file mode 100644 index 0000000..7a3cc63 --- /dev/null +++ b/tests/calcite/testReduceConstantsRequiresExecutor.json @@ -0,0 +1,78 @@ +{ + "schemas" : [ ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ ] + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalFilter(condition=[>(+(1, 2), +(3, null))])\n LogicalValues(tuples=[[{ 1, 2 }]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceDynamic.json b/tests/calcite/testReduceDynamic.json new file mode 100644 index 0000000..dfc0fef --- /dev/null +++ b/tests/calcite/testReduceDynamic.json @@ -0,0 +1,34 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "USER", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "operator" : "_ISO-8859-1'happyCalciteUser'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(USER=[USER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(USER=['happyCalciteUser':VARCHAR(2000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceNestedCaseWhen.json b/tests/calcite/testReduceNestedCaseWhen.json new file mode 100644 index 0000000..1cb6f72 --- /dev/null +++ b/tests/calcite/testReduceNestedCaseWhen.json @@ -0,0 +1,126 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "2000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "SEARCH", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "Sarg[1000, 2000]", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[IS TRUE(CASE(=($5, 1000), IS NULL(CASE(=($5, 1000), null:INTEGER, 1)), IS NULL(CASE(=($5, 2000), null:INTEGER, 1))))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[SEARCH($5, Sarg[1000, 2000])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceNullableToNotNull.json b/tests/calcite/testReduceNullableToNotNull.json new file mode 100644 index 0000000..f6fbfe2 --- /dev/null +++ b/tests/calcite/testReduceNullableToNotNull.json @@ -0,0 +1,68 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "operator" : "_ISO-8859-1'a'", + "operand" : [ ], + "type" : "CHAR" + }, { + "operator" : "_ISO-8859-1'a'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(NEWCOL=[+($0, CASE(=('a', 'a'), 1, null:INTEGER))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(NEWCOL=[+($0, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceNullableToNotNull2.json b/tests/calcite/testReduceNullableToNotNull2.json new file mode 100644 index 0000000..f6fbfe2 --- /dev/null +++ b/tests/calcite/testReduceNullableToNotNull2.json @@ -0,0 +1,68 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "operator" : "_ISO-8859-1'a'", + "operand" : [ ], + "type" : "CHAR" + }, { + "operator" : "_ISO-8859-1'a'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(NEWCOL=[+($0, CASE(=('a', 'a'), 1, null:INTEGER))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(NEWCOL=[+($0, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceOrCaseWhen.json b/tests/calcite/testReduceOrCaseWhen.json new file mode 100644 index 0000000..9f342e4 --- /dev/null +++ b/tests/calcite/testReduceOrCaseWhen.json @@ -0,0 +1,111 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "2000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "SEARCH", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "Sarg[1000, 2000]", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[OR(IS NULL(CASE(=($5, 1000), null:INTEGER, 1)), IS NULL(CASE(=($5, 2000), null:INTEGER, 1)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[SEARCH($5, Sarg[1000, 2000])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceValuesToEmpty.json b/tests/calcite/testReduceValuesToEmpty.json new file mode 100644 index 0000000..76abb4e --- /dev/null +++ b/tests/calcite/testReduceValuesToEmpty.json @@ -0,0 +1,75 @@ +{ + "schemas" : [ ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "operator" : "-", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], [ { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + } + } + }, { + "values" : { + "schema" : [ "INTEGER", "INTEGER", "INTEGER" ], + "content" : [ ] + } + } ], + "help" : [ "LogicalProject(X=[+($0, $1)], B=[$1], A=[$0])\n LogicalFilter(condition=[<(-($0, $1), 0)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 7 }]])\n", "LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceValuesUnderFilter.json b/tests/calcite/testReduceValuesUnderFilter.json new file mode 100644 index 0000000..784a63b --- /dev/null +++ b/tests/calcite/testReduceValuesUnderFilter.json @@ -0,0 +1,77 @@ +{ + "schemas" : [ ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "CHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "15", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "values" : { + "schema" : [ "INTEGER", "CHAR" ], + "content" : [ [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "_ISO-8859-1'x'", + "operand" : [ ], + "type" : "CHAR" + } ], [ { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "_ISO-8859-1'y'", + "operand" : [ ], + "type" : "CHAR" + } ] ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "CHAR" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "CHAR" ], + "content" : [ [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "_ISO-8859-1'x'", + "operand" : [ ], + "type" : "CHAR" + } ] ] + } + } + } + } ], + "help" : [ "LogicalProject(A=[$0], B=[$1])\n LogicalFilter(condition=[<($0, 15)])\n LogicalValues(tuples=[[{ 10, 'x' }, { 20, 'y' }]])\n", "LogicalProject(A=[$0], B=[$1])\n LogicalValues(tuples=[[{ 10, 'x' }]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceValuesUnderProject.json b/tests/calcite/testReduceValuesUnderProject.json new file mode 100644 index 0000000..718e7e6 --- /dev/null +++ b/tests/calcite/testReduceValuesUnderProject.json @@ -0,0 +1,54 @@ +{ + "schemas" : [ ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], [ { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + }, { + "values" : { + "schema" : [ "INTEGER" ], + "content" : [ [ { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + } ], [ { + "operator" : "23", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } ], + "help" : [ "LogicalProject(EXPR$0=[+($0, $1)])\n LogicalValues(tuples=[[{ 10, 1 }, { 20, 3 }]])\n", "LogicalValues(tuples=[[{ 11 }, { 23 }]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceValuesUnderProjectFilter.json b/tests/calcite/testReduceValuesUnderProjectFilter.json new file mode 100644 index 0000000..656d296 --- /dev/null +++ b/tests/calcite/testReduceValuesUnderProjectFilter.json @@ -0,0 +1,107 @@ +{ + "schemas" : [ ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "+", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "operator" : "-", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "21", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], [ { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], [ { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } + } + } + } + }, { + "values" : { + "schema" : [ "INTEGER", "INTEGER", "INTEGER" ], + "content" : [ [ { + "operator" : "11", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], [ { + "operator" : "23", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ] ] + } + } ], + "help" : [ "LogicalProject(X=[+($0, $1)], B=[$1], A=[$0])\n LogicalFilter(condition=[<(-($0, $1), 21)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 7 }, { 20, 3 }]])\n", "LogicalValues(tuples=[[{ 11, 1, 10 }, { 23, 3, 20 }]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testReduceWithNonTypePredicate.json b/tests/calcite/testReduceWithNonTypePredicate.json new file mode 100644 index 0000000..154fe2e --- /dev/null +++ b/tests/calcite/testReduceWithNonTypePredicate.json @@ -0,0 +1,207 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "AVG", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "AVG", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "AVG", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "$SUM0", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[AVG($0)], EXPR$1=[AVG($0) WITHIN DISTINCT ($1)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[CAST(/($1, $2)):INTEGER])\n LogicalProject(EXPR$0=[$0], $f1=[CASE(=($2, 0), null:INTEGER, $1)], $f2=[$2])\n LogicalAggregate(group=[{}], EXPR$0=[AVG($0)], agg#1=[$SUM0($0) WITHIN DISTINCT ($1)], agg#2=[COUNT() WITHIN DISTINCT ($1)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testRemoveDistinctOnAgg.json b/tests/calcite/testRemoveDistinctOnAgg.json new file mode 100644 index 0000000..df61d12 --- /dev/null +++ b/tests/calcite/testRemoveDistinctOnAgg.json @@ -0,0 +1,208 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "BIT_AND", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "BIT_OR", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "BIGINT" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], EXPR$1=[$2], EXPR$2=[$3], EXPR$3=[$3], EXPR$4=[$4], EXPR$5=[$5], EXPR$6=[$6], EXPR$7=[$7])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM(DISTINCT $2)], EXPR$2=[MIN($2)], EXPR$4=[MAX($2)], EXPR$5=[BIT_AND($2)], EXPR$6=[BIT_OR($2)], EXPR$7=[COUNT(DISTINCT $2)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], EXPR$1=[$5], EXPR$2=[$5], EXPR$3=[$5], EXPR$4=[$5], EXPR$5=[$5], EXPR$6=[$5], EXPR$7=[1:BIGINT])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testRemoveSemiJoin.json b/tests/calcite/testRemoveSemiJoin.json new file mode 100644 index 0000000..a7ddb6c --- /dev/null +++ b/tests/calcite/testRemoveSemiJoin.json @@ -0,0 +1,86 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } ], + "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[=($7, $9)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testRemoveSemiJoinRight.json b/tests/calcite/testRemoveSemiJoinRight.json new file mode 100644 index 0000000..2530477 --- /dev/null +++ b/tests/calcite/testRemoveSemiJoinRight.json @@ -0,0 +1,132 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($9, $18))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($9, $18)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testRemoveSemiJoinRightWithFilter.json b/tests/calcite/testRemoveSemiJoinRightWithFilter.json new file mode 100644 index 0000000..5f04604 --- /dev/null +++ b/tests/calcite/testRemoveSemiJoinRightWithFilter.json @@ -0,0 +1,159 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'foo'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'foo'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($9, $18), =($10, 'foo'))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($9, $18)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($1, 'foo')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testRemoveSemiJoinWithFilter.json b/tests/calcite/testRemoveSemiJoinWithFilter.json new file mode 100644 index 0000000..a8822ac --- /dev/null +++ b/tests/calcite/testRemoveSemiJoinWithFilter.json @@ -0,0 +1,117 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'foo'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'foo'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } ], + "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($1, 'foo'))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalFilter(condition=[=($1, 'foo')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testRightEmptyAntiJoin.json b/tests/calcite/testRightEmptyAntiJoin.json new file mode 100644 index 0000000..8567e15 --- /dev/null +++ b/tests/calcite/testRightEmptyAntiJoin.json @@ -0,0 +1,54 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "SMALLINT" + } ], + "source" : { + "join" : { + "kind" : "ANTI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 8, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "values" : { + "schema" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "content" : [ ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "SMALLINT" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($7, $8)], joinType=[anti])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n", "LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[scott, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testRightEmptyAntiJoinNonEqui.json b/tests/calcite/testRightEmptyAntiJoinNonEqui.json new file mode 100644 index 0000000..98f88b0 --- /dev/null +++ b/tests/calcite/testRightEmptyAntiJoinNonEqui.json @@ -0,0 +1,69 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "SMALLINT" + } ], + "source" : { + "join" : { + "kind" : "ANTI", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 8, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "DECIMAL" + }, { + "operator" : "2000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "values" : { + "schema" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "content" : [ ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "SMALLINT" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[AND(=($7, $8), =($5, 2000))], joinType=[anti])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n", "LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[scott, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testRightEmptyFullJoin.json b/tests/calcite/testRightEmptyFullJoin.json new file mode 100644 index 0000000..2afc1f9 --- /dev/null +++ b/tests/calcite/testRightEmptyFullJoin.json @@ -0,0 +1,160 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "FULL", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR" ], + "content" : [ ] + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testRightEmptyInnerJoin.json b/tests/calcite/testRightEmptyInnerJoin.json new file mode 100644 index 0000000..8b5e717 --- /dev/null +++ b/tests/calcite/testRightEmptyInnerJoin.json @@ -0,0 +1,141 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN", "INTEGER", "VARCHAR" ], + "content" : [ ] + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testRightEmptyLeftJoin.json b/tests/calcite/testRightEmptyLeftJoin.json new file mode 100644 index 0000000..62bc97b --- /dev/null +++ b/tests/calcite/testRightEmptyLeftJoin.json @@ -0,0 +1,160 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR" ], + "content" : [ ] + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testRightEmptyRightJoin.json b/tests/calcite/testRightEmptyRightJoin.json new file mode 100644 index 0000000..ac6cd20 --- /dev/null +++ b/tests/calcite/testRightEmptyRightJoin.json @@ -0,0 +1,141 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "false", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN", "INTEGER", "VARCHAR" ], + "content" : [ ] + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testRightEmptySemiJoin.json b/tests/calcite/testRightEmptySemiJoin.json new file mode 100644 index 0000000..9c622db --- /dev/null +++ b/tests/calcite/testRightEmptySemiJoin.json @@ -0,0 +1,57 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "SMALLINT" + } ], + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 8, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "values" : { + "schema" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "content" : [ ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "SMALLINT" + } ], + "source" : { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "content" : [ ] + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($7, $8)], joinType=[semi])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n", "LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testRightOuterJoinSimplificationToInner.json b/tests/calcite/testRightOuterJoinSimplificationToInner.json new file mode 100644 index 0000000..ae0d0e8 --- /dev/null +++ b/tests/calcite/testRightOuterJoinSimplificationToInner.json @@ -0,0 +1,157 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'Charlie'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "CAST", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'Charlie'", + "operand" : [ ], + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalJoin(condition=[=($0, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalProject(DEPTNO=[CAST($0):INTEGER], NAME=[CAST($1):VARCHAR(10)], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSemiJoinProjectTranspose.json b/tests/calcite/testSemiJoinProjectTranspose.json new file mode 100644 index 0000000..b0011b1 --- /dev/null +++ b/tests/calcite/testSemiJoinProjectTranspose.json @@ -0,0 +1,236 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "*", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "TINYINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "*", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "TINYINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "operator" : "*", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "TINYINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "*", + "operand" : [ { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "TINYINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[semi])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalProject($f0=[$0])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSemiJoinReduceConstants.json b/tests/calcite/testSemiJoinReduceConstants.json new file mode 100644 index 0000000..97ea134 --- /dev/null +++ b/tests/calcite/testSemiJoinReduceConstants.json @@ -0,0 +1,195 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "200", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "200", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "200", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(SAL=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\n LogicalFilter(condition=[=($1, 200)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[=($0, 100)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$0])\n LogicalJoin(condition=[=(200, $2)], joinType=[semi])\n LogicalFilter(condition=[=($1, 200)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[=($0, 100)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSemiJoinRule.json b/tests/calcite/testSemiJoinRule.json new file mode 100644 index 0000000..3674681 --- /dev/null +++ b/tests/calcite/testSemiJoinRule.json @@ -0,0 +1,182 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSemiJoinRuleExists.json b/tests/calcite/testSemiJoinRuleExists.json new file mode 100644 index 0000000..3674681 --- /dev/null +++ b/tests/calcite/testSemiJoinRuleExists.json @@ -0,0 +1,182 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSemiJoinRuleLeft.json b/tests/calcite/testSemiJoinRuleLeft.json new file mode 100644 index 0000000..1adb44f --- /dev/null +++ b/tests/calcite/testSemiJoinRuleLeft.json @@ -0,0 +1,144 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(NAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSemiJoinRuleWithHint.json b/tests/calcite/testSemiJoinRuleWithHint.json new file mode 100644 index 0000000..a94df15 --- /dev/null +++ b/tests/calcite/testSemiJoinRuleWithHint.json @@ -0,0 +1,139 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], + "key" : [ [ 0 ], [ 1 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 3, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "TINYINT" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "TINYINT" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 1, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "TINYINT" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "TINYINT" + }, { + "column" : 3, + "type" : "TINYINT" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "TINYINT" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[scott, EMP]])\n", "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[semi])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[scott, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSemiJoinRuleWithJoinOnUniqueInput.json b/tests/calcite/testSemiJoinRuleWithJoinOnUniqueInput.json new file mode 100644 index 0000000..fc36dde --- /dev/null +++ b/tests/calcite/testSemiJoinRuleWithJoinOnUniqueInput.json @@ -0,0 +1,109 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSemiJoinTrim.json b/tests/calcite/testSemiJoinTrim.json new file mode 100644 index 0000000..39482fe --- /dev/null +++ b/tests/calcite/testSemiJoinTrim.json @@ -0,0 +1,201 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "ACCOUNT", + "fields" : [ "ACCTNO", "TYPE", "BALANCE" ], + "types" : [ "INTEGER", "VARCHAR", "INTEGER" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, + "right" : { + "scan" : 2 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 2 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7], $f0=[true])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, CUSTOMER, ACCOUNT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalJoin(condition=[=($0, $1)], joinType=[semi])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ACCTNO=[$0])\n LogicalTableScan(table=[[CATALOG, CUSTOMER, ACCOUNT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSimplifyFilter.json b/tests/calcite/testSimplifyFilter.json new file mode 100644 index 0000000..cf539c0 --- /dev/null +++ b/tests/calcite/testSimplifyFilter.json @@ -0,0 +1,223 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "5", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "3", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(>($0, 3), >($7, 5))])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>($0, 3)])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSkipReduceConstantsCaseEquals.json b/tests/calcite/testSkipReduceConstantsCaseEquals.json new file mode 100644 index 0000000..213427c --- /dev/null +++ b/tests/calcite/testSkipReduceConstantsCaseEquals.json @@ -0,0 +1,257 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "CASE", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "-1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalFilter(condition=[=(CASE(IS NOT NULL($3), CAST($3):INTEGER NOT NULL, -1), CASE(IS NOT NULL($12), CAST($12):INTEGER NOT NULL, -1))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[=(CASE(IS NOT NULL($3), CAST($3):INTEGER NOT NULL, -1), CASE(IS NOT NULL($12), CAST($12):INTEGER NOT NULL, -1))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSome.json b/tests/calcite/testSome.json new file mode 100644 index 0000000..0ba884b --- /dev/null +++ b/tests/calcite/testSome.json @@ -0,0 +1,355 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "> SOME", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + }, + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "column" : 11, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT TRUE", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT TRUE", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<=", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "column" : 11, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 1, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[> SOME($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(AND(IS TRUE(>($0, $9)), <>($10, 0)), AND(>($10, $11), null, <>($10, 0), IS NOT TRUE(>($0, $9))), AND(>($0, $9), <>($10, 0), IS NOT TRUE(>($0, $9)), <=($10, $11)))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(m=[$0], c=[$1], d=[$1])\n LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSomeWithEquality.json b/tests/calcite/testSomeWithEquality.json new file mode 100644 index 0000000..a6b62c3 --- /dev/null +++ b/tests/calcite/testSomeWithEquality.json @@ -0,0 +1,169 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + }, + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IN($7, {\nLogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSomeWithEquality2.json b/tests/calcite/testSomeWithEquality2.json new file mode 100644 index 0000000..69f3bc8 --- /dev/null +++ b/tests/calcite/testSomeWithEquality2.json @@ -0,0 +1,215 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + }, + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IN($1, {\nLogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($1, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSomeWithNotEquality.json b/tests/calcite/testSomeWithNotEquality.json new file mode 100644 index 0000000..5f6bef7 --- /dev/null +++ b/tests/calcite/testSomeWithNotEquality.json @@ -0,0 +1,400 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<> SOME", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + }, + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "<>", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "column" : 9, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<=", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "OR", + "operand" : [ { + "operator" : "<>", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "OR", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "column" : 9, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "<>", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "OR", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "column" : 9, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<>", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "BIGINT" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[<> SOME($7, {\nLogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(AND(<>($10, $9), <=($10, 1), OR(<>($7, $11), null), <>($9, 0)), AND(=($10, 1), <>($7, $11), <>($9, 0), OR(=($10, $9), >($10, 1))), AND(<>($9, 0), OR(=($10, $9), >($10, 1)), <>($10, 1)))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(c=[$0], d=[$0], m=[$1])\n LogicalAggregate(group=[{}], c=[COUNT()], m=[MAX($0)])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSortJoinCopyInnerJoinOrderBy.json b/tests/calcite/testSortJoinCopyInnerJoinOrderBy.json new file mode 100644 index 0000000..31bef90 --- /dev/null +++ b/tests/calcite/testSortJoinCopyInnerJoinOrderBy.json @@ -0,0 +1,152 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "sort" : { + "collation" : [ [ 5, "INTEGER", "ASC" ] ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "sort" : { + "collation" : [ [ 5, "INTEGER", "ASC" ] ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "sort" : { + "collation" : [ [ 5, "INTEGER", "ASC" ] ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSortJoinCopyInnerJoinOrderByLimit.json b/tests/calcite/testSortJoinCopyInnerJoinOrderByLimit.json new file mode 100644 index 0000000..71dcb62 --- /dev/null +++ b/tests/calcite/testSortJoinCopyInnerJoinOrderByLimit.json @@ -0,0 +1,184 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "sort" : { + "collation" : [ [ 5, "INTEGER", "ASC" ] ], + "limit" : { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "sort" : { + "collation" : [ [ 5, "INTEGER", "ASC" ] ], + "limit" : { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "sort" : { + "collation" : [ [ 5, "INTEGER", "ASC" ] ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSortJoinCopyInnerJoinOrderByTwoFields.json b/tests/calcite/testSortJoinCopyInnerJoinOrderByTwoFields.json new file mode 100644 index 0000000..5926929 --- /dev/null +++ b/tests/calcite/testSortJoinCopyInnerJoinOrderByTwoFields.json @@ -0,0 +1,157 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "sort" : { + "collation" : [ [ 5, "INTEGER", "ASC" ], [ 10, "VARCHAR", "ASC" ] ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "sort" : { + "collation" : [ [ 5, "INTEGER", "ASC" ], [ 10, "VARCHAR", "ASC" ] ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "sort" : { + "collation" : [ [ 5, "INTEGER", "ASC" ] ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "sort" : { + "collation" : [ [ 1, "VARCHAR", "ASC" ] ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], sort1=[$10], dir0=[ASC], dir1=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], sort1=[$10], dir0=[ASC], dir1=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalSort(sort0=[$1], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSortJoinCopySemiJoinOrderBy.json b/tests/calcite/testSortJoinCopySemiJoinOrderBy.json new file mode 100644 index 0000000..592d046 --- /dev/null +++ b/tests/calcite/testSortJoinCopySemiJoinOrderBy.json @@ -0,0 +1,92 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "sort" : { + "collation" : [ [ 0, "INTEGER", "ASC" ] ], + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "sort" : { + "collation" : [ [ 0, "INTEGER", "ASC" ] ], + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "sort" : { + "collation" : [ [ 0, "INTEGER", "ASC" ] ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSortJoinCopySemiJoinOrderByLimitOffset.json b/tests/calcite/testSortJoinCopySemiJoinOrderByLimitOffset.json new file mode 100644 index 0000000..4865645 --- /dev/null +++ b/tests/calcite/testSortJoinCopySemiJoinOrderByLimitOffset.json @@ -0,0 +1,112 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "sort" : { + "collation" : [ [ 0, "INTEGER", "ASC" ] ], + "offset" : { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, + "limit" : { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "sort" : { + "collation" : [ [ 0, "INTEGER", "ASC" ] ], + "offset" : { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, + "limit" : { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "sort" : { + "collation" : [ [ 0, "INTEGER", "ASC" ] ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalSort(sort0=[$0], dir0=[ASC], offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalSort(sort0=[$0], dir0=[ASC], offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSortJoinCopySemiJoinOrderByOffset.json b/tests/calcite/testSortJoinCopySemiJoinOrderByOffset.json new file mode 100644 index 0000000..9865bca --- /dev/null +++ b/tests/calcite/testSortJoinCopySemiJoinOrderByOffset.json @@ -0,0 +1,102 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "sort" : { + "collation" : [ [ 0, "INTEGER", "ASC" ] ], + "offset" : { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "sort" : { + "collation" : [ [ 0, "INTEGER", "ASC" ] ], + "offset" : { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "join" : { + "kind" : "SEMI", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "sort" : { + "collation" : [ [ 0, "INTEGER", "ASC" ] ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalSort(sort0=[$0], dir0=[ASC], offset=[2])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalSort(sort0=[$0], dir0=[ASC], offset=[2])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSortJoinTranspose1.json b/tests/calcite/testSortJoinTranspose1.json new file mode 100644 index 0000000..d45acb8 --- /dev/null +++ b/tests/calcite/testSortJoinTranspose1.json @@ -0,0 +1,189 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "sort" : { + "collation" : [ [ 5, "INTEGER", "ASC" ] ], + "limit" : { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "sort" : { + "collation" : [ [ 5, "INTEGER", "ASC" ] ], + "limit" : { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "sort" : { + "collation" : [ [ 5, "INTEGER", "ASC" ] ], + "limit" : { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSortJoinTranspose2.json b/tests/calcite/testSortJoinTranspose2.json new file mode 100644 index 0000000..8cb9162 --- /dev/null +++ b/tests/calcite/testSortJoinTranspose2.json @@ -0,0 +1,174 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "sort" : { + "collation" : [ [ 10, "VARCHAR", "ASC" ] ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "sort" : { + "collation" : [ [ 10, "VARCHAR", "ASC" ] ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "sort" : { + "collation" : [ [ 1, "VARCHAR", "ASC" ] ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalSort(sort0=[$1], dir0=[ASC])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSortJoinTranspose4.json b/tests/calcite/testSortJoinTranspose4.json new file mode 100644 index 0000000..8cb9162 --- /dev/null +++ b/tests/calcite/testSortJoinTranspose4.json @@ -0,0 +1,174 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "sort" : { + "collation" : [ [ 10, "VARCHAR", "ASC" ] ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "sort" : { + "collation" : [ [ 10, "VARCHAR", "ASC" ] ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "sort" : { + "collation" : [ [ 1, "VARCHAR", "ASC" ] ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalSort(sort0=[$1], dir0=[ASC])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSortJoinTranspose6.json b/tests/calcite/testSortJoinTranspose6.json new file mode 100644 index 0000000..223f659 --- /dev/null +++ b/tests/calcite/testSortJoinTranspose6.json @@ -0,0 +1,128 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "sort" : { + "collation" : [ ], + "offset" : { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, + "limit" : { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "sort" : { + "collation" : [ ], + "offset" : { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, + "limit" : { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "sort" : { + "collation" : [ ], + "offset" : { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + }, + "limit" : { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], EMPNO=[$2])\n LogicalSort(offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EMPNO=[$2])\n LogicalSort(offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalSort(offset=[2], fetch=[10])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSortProjectTranspose1.json b/tests/calcite/testSortProjectTranspose1.json new file mode 100644 index 0000000..e797a6e --- /dev/null +++ b/tests/calcite/testSortProjectTranspose1.json @@ -0,0 +1,58 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "sort" : { + "collation" : [ [ 1, "INTEGER", "ASC" ] ], + "offset" : { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "sort" : { + "collation" : [ [ 0, "INTEGER", "ASC" ] ], + "offset" : { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalSort(sort0=[$1], dir0=[ASC], offset=[1])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$0])\n LogicalSort(sort0=[$0], dir0=[ASC], offset=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSortProjectTranspose2.json b/tests/calcite/testSortProjectTranspose2.json new file mode 100644 index 0000000..3b02b77 --- /dev/null +++ b/tests/calcite/testSortProjectTranspose2.json @@ -0,0 +1,66 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "sort" : { + "collation" : [ [ 1, "DOUBLE", "ASC" ] ], + "offset" : { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "DOUBLE" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "type" : "DOUBLE" + } ], + "source" : { + "sort" : { + "collation" : [ [ 0, "INTEGER", "ASC" ] ], + "offset" : { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalSort(sort0=[$1], dir0=[ASC], offset=[1])\n LogicalProject(DEPTNO=[$0], EXPR$1=[CAST($0):DOUBLE NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[CAST($0):DOUBLE NOT NULL])\n LogicalSort(sort0=[$0], dir0=[ASC], offset=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSortRemovalAllKeysConstant.json b/tests/calcite/testSortRemovalAllKeysConstant.json new file mode 100644 index 0000000..eaaed08 --- /dev/null +++ b/tests/calcite/testSortRemovalAllKeysConstant.json @@ -0,0 +1,265 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "sort" : { + "collation" : [ [ 1, "INTEGER", "DESC-nulls-last" ] ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalSort(sort0=[$1], dir0=[DESC-nulls-last])\n LogicalProject(C=[$2], DEPTNO=[$0])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(C=[$2], DEPTNO=[$0])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSortRemovalOneKeyConstant.json b/tests/calcite/testSortRemovalOneKeyConstant.json new file mode 100644 index 0000000..3ea6b44 --- /dev/null +++ b/tests/calcite/testSortRemovalOneKeyConstant.json @@ -0,0 +1,276 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "sort" : { + "collation" : [ [ 1, "INTEGER", "ASC" ], [ 2, "INTEGER", "DESC" ] ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "sort" : { + "collation" : [ [ 2, "INTEGER", "DESC" ] ], + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalSort(sort0=[$1], sort1=[$2], dir0=[ASC], dir1=[DESC])\n LogicalProject(C=[$2], DEPTNO=[$0], SAL=[$1])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalSort(sort0=[$2], dir0=[DESC])\n LogicalProject(C=[$2], DEPTNO=[$0], SAL=[$1])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSortUnionTranspose.json b/tests/calcite/testSortUnionTranspose.json new file mode 100644 index 0000000..fd14cc9 --- /dev/null +++ b/tests/calcite/testSortUnionTranspose.json @@ -0,0 +1,104 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "sort" : { + "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "limit" : { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "sort" : { + "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "limit" : { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "union" : [ { + "sort" : { + "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "limit" : { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "sort" : { + "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "limit" : { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } ], + "help" : [ "LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalProject(NAME=[$0])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalUnion(all=[true])\n LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSortUnionTranspose2.json b/tests/calcite/testSortUnionTranspose2.json new file mode 100644 index 0000000..17917dc --- /dev/null +++ b/tests/calcite/testSortUnionTranspose2.json @@ -0,0 +1,84 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "sort" : { + "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "sort" : { + "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "source" : { + "union" : [ { + "sort" : { + "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "sort" : { + "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } ], + "help" : [ "LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalProject(NAME=[$0])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalUnion(all=[true])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSortUnionTranspose3.json b/tests/calcite/testSortUnionTranspose3.json new file mode 100644 index 0000000..bf8ebb8 --- /dev/null +++ b/tests/calcite/testSortUnionTranspose3.json @@ -0,0 +1,104 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "sort" : { + "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "limit" : { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "sort" : { + "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "limit" : { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "union" : [ { + "sort" : { + "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "limit" : { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "sort" : { + "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "limit" : { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } ] + } + } + } ], + "help" : [ "LogicalSort(sort0=[$0], dir0=[ASC], fetch=[0])\n LogicalProject(NAME=[$0])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalSort(sort0=[$0], dir0=[ASC], fetch=[0])\n LogicalUnion(all=[true])\n LogicalSort(sort0=[$0], dir0=[ASC], fetch=[0])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalSort(sort0=[$0], dir0=[ASC], fetch=[0])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSpatialContainsPoint.json b/tests/calcite/testSpatialContainsPoint.json new file mode 100644 index 0000000..9d37ad2 --- /dev/null +++ b/tests/calcite/testSpatialContainsPoint.json @@ -0,0 +1,133 @@ +{ + "schemas" : [ { + "name" : "RESTAURANTS", + "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], + "types" : [ "VARCHAR", "INTEGER", "INTEGER", "VARCHAR", "BIGINT" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "ST_CONTAINS", + "operand" : [ { + "operator" : "ST_BUFFER", + "operand" : [ { + "operator" : "ST_POINT", + "operand" : [ { + "operator" : "10.0", + "operand" : [ ], + "type" : "DECIMAL" + }, { + "operator" : "20.0", + "operand" : [ ], + "type" : "DECIMAL" + } ], + "type" : "GEOMETRY" + }, { + "operator" : "6", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "GEOMETRY" + }, { + "operator" : "ST_POINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "GEOMETRY" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "SEARCH", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "ST_CONTAINS", + "operand" : [ { + "operator" : "POLYGON ((16 20, 15.884711682419383 18.829458067903232, 15.54327719506772 17.703899405809462, 14.988817673815271 16.666578601882385, 14.242640687119286 15.757359312880716, 13.333421398117615 15.011182326184729, 12.29610059419054 14.45672280493228, 11.17054193209677 14.115288317580617, 10 14, 8.82945806790323 14.115288317580617, 7.703899405809461 14.45672280493228, 6.666578601882389 15.011182326184727, 5.757359312880715 15.757359312880714, 5.011182326184728 16.666578601882385, 4.45672280493228 17.70389940580946, 4.115288317580617 18.82945806790323, 4 20, 4.115288317580617 21.17054193209677, 4.456722804932279 22.296100594190538, 5.011182326184727 23.33342139811761, 5.757359312880714 24.242640687119284, 6.666578601882387 24.98881767381527, 7.703899405809458 25.54327719506772, 8.829458067903229 25.884711682419383, 9.999999999999998 26, 11.17054193209677 25.884711682419383, 12.29610059419054 25.54327719506772, 13.333421398117611 24.988817673815273, 14.242640687119284 24.242640687119284, 14.988817673815271 23.333421398117615, 15.54327719506772 22.29610059419054, 15.884711682419383 21.17054193209677, 16 20))", + "operand" : [ ], + "type" : "GEOMETRY" + }, { + "operator" : "ST_POINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "GEOMETRY" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_CONTAINS(ST_BUFFER(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), 6), ST_POINT($2, $1))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]), ST_CONTAINS(POLYGON ((16 20, 15.884711682419383 18.829458067903232, 15.54327719506772 17.703899405809462, 14.988817673815271 16.666578601882385, 14.242640687119286 15.757359312880716, 13.333421398117615 15.011182326184729, 12.29610059419054 14.45672280493228, 11.17054193209677 14.115288317580617, 10 14, 8.82945806790323 14.115288317580617, 7.703899405809461 14.45672280493228, 6.666578601882389 15.011182326184727, 5.757359312880715 15.757359312880714, 5.011182326184728 16.666578601882385, 4.45672280493228 17.70389940580946, 4.115288317580617 18.82945806790323, 4 20, 4.115288317580617 21.17054193209677, 4.456722804932279 22.296100594190538, 5.011182326184727 23.33342139811761, 5.757359312880714 24.242640687119284, 6.666578601882387 24.98881767381527, 7.703899405809458 25.54327719506772, 8.829458067903229 25.884711682419383, 9.999999999999998 26, 11.17054193209677 25.884711682419383, 12.29610059419054 25.54327719506772, 13.333421398117611 24.988817673815273, 14.242640687119284 24.242640687119284, 14.988817673815271 23.333421398117615, 15.54327719506772 22.29610059419054, 15.884711682419383 21.17054193209677, 16 20)):GEOMETRY, ST_POINT($2, $1)))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSpatialDWithinLine.json b/tests/calcite/testSpatialDWithinLine.json new file mode 100644 index 0000000..00eb82a --- /dev/null +++ b/tests/calcite/testSpatialDWithinLine.json @@ -0,0 +1,149 @@ +{ + "schemas" : [ { + "name" : "RESTAURANTS", + "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], + "types" : [ "VARCHAR", "INTEGER", "INTEGER", "VARCHAR", "BIGINT" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "ST_DWITHIN", + "operand" : [ { + "operator" : "ST_MAKELINE", + "operand" : [ { + "operator" : "ST_POINT", + "operand" : [ { + "operator" : "8.0", + "operand" : [ ], + "type" : "DECIMAL" + }, { + "operator" : "20.0", + "operand" : [ ], + "type" : "DECIMAL" + } ], + "type" : "GEOMETRY" + }, { + "operator" : "ST_POINT", + "operand" : [ { + "operator" : "12.0", + "operand" : [ ], + "type" : "DECIMAL" + }, { + "operator" : "20.0", + "operand" : [ ], + "type" : "DECIMAL" + } ], + "type" : "GEOMETRY" + } ], + "type" : "GEOMETRY" + }, { + "operator" : "ST_POINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "GEOMETRY" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "SEARCH", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "Sarg[[33064..33076], [33092..33100], [33112..33156], [33164..33176], [33236..33240], [36457..36459], [36501..36503], [36505..36507], [36517..36519]]", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "ST_DWITHIN", + "operand" : [ { + "operator" : "LINESTRING (8 20, 12 20)", + "operand" : [ ], + "type" : "GEOMETRY" + }, { + "operator" : "ST_POINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "GEOMETRY" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_MAKELINE(ST_POINT(8.0:DECIMAL(2, 1), 20.0:DECIMAL(3, 1)), ST_POINT(12.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1))), ST_POINT($2, $1), 4)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[33064..33076], [33092..33100], [33112..33156], [33164..33176], [33236..33240], [36457..36459], [36501..36503], [36505..36507], [36517..36519]]), ST_DWITHIN(LINESTRING (8 20, 12 20):GEOMETRY, ST_POINT($2, $1), 4))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSpatialDWithinReversed.json b/tests/calcite/testSpatialDWithinReversed.json new file mode 100644 index 0000000..815184d --- /dev/null +++ b/tests/calcite/testSpatialDWithinReversed.json @@ -0,0 +1,133 @@ +{ + "schemas" : [ { + "name" : "RESTAURANTS", + "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], + "types" : [ "VARCHAR", "INTEGER", "INTEGER", "VARCHAR", "BIGINT" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "ST_DWITHIN", + "operand" : [ { + "operator" : "ST_POINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "GEOMETRY" + }, { + "operator" : "ST_POINT", + "operand" : [ { + "operator" : "10.0", + "operand" : [ ], + "type" : "DECIMAL" + }, { + "operator" : "20.0", + "operand" : [ ], + "type" : "DECIMAL" + } ], + "type" : "GEOMETRY" + }, { + "operator" : "6", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "SEARCH", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "ST_DWITHIN", + "operand" : [ { + "operator" : "ST_POINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "GEOMETRY" + }, { + "operator" : "POINT (10 20)", + "operand" : [ ], + "type" : "GEOMETRY" + }, { + "operator" : "6", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT($2, $1), ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), 6)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]), ST_DWITHIN(ST_POINT($2, $1), POINT (10 20):GEOMETRY, 6))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSpatialDWithinToHilbert.json b/tests/calcite/testSpatialDWithinToHilbert.json new file mode 100644 index 0000000..fab21f6 --- /dev/null +++ b/tests/calcite/testSpatialDWithinToHilbert.json @@ -0,0 +1,133 @@ +{ + "schemas" : [ { + "name" : "RESTAURANTS", + "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], + "types" : [ "VARCHAR", "INTEGER", "INTEGER", "VARCHAR", "BIGINT" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "ST_DWITHIN", + "operand" : [ { + "operator" : "ST_POINT", + "operand" : [ { + "operator" : "10.0", + "operand" : [ ], + "type" : "DECIMAL" + }, { + "operator" : "20.0", + "operand" : [ ], + "type" : "DECIMAL" + } ], + "type" : "GEOMETRY" + }, { + "operator" : "ST_POINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "GEOMETRY" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "SEARCH", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "Sarg[[28988..28989], [28991..28994], [29006..29009], [29011..29014], [32426..32429], [32431..32434], [32446..32449], [32451..32454], [32506..32509], [32511..32514], [32526..32527], [32929..32930], [32942..32949], [32951..32953], [32955..32970], [32973..32975], [33009..33011], [33014..33185], [33187..33190], [33205..33207], [33209..33211], [33226..33229], [33231..33265], [33267..33270], [36392..36401], [36403..36404], [36421..36423], [36425..36427], [36442..36445], [36447..36548], [36556..36568]]", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "ST_DWITHIN", + "operand" : [ { + "operator" : "POINT (10 20)", + "operand" : [ ], + "type" : "GEOMETRY" + }, { + "operator" : "ST_POINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "GEOMETRY" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), ST_POINT($2, $1), 10)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[28988..28989], [28991..28994], [29006..29009], [29011..29014], [32426..32429], [32431..32434], [32446..32449], [32451..32454], [32506..32509], [32511..32514], [32526..32527], [32929..32930], [32942..32949], [32951..32953], [32955..32970], [32973..32975], [33009..33011], [33014..33185], [33187..33190], [33205..33207], [33209..33211], [33226..33229], [33231..33265], [33267..33270], [36392..36401], [36403..36404], [36421..36423], [36425..36427], [36442..36445], [36447..36548], [36556..36568]]), ST_DWITHIN(POINT (10 20):GEOMETRY, ST_POINT($2, $1), 10))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSpatialDWithinToHilbertNegative.json b/tests/calcite/testSpatialDWithinToHilbertNegative.json new file mode 100644 index 0000000..bdd57a6 --- /dev/null +++ b/tests/calcite/testSpatialDWithinToHilbertNegative.json @@ -0,0 +1,94 @@ +{ + "schemas" : [ { + "name" : "RESTAURANTS", + "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], + "types" : [ "VARCHAR", "INTEGER", "INTEGER", "VARCHAR", "BIGINT" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "ST_DWITHIN", + "operand" : [ { + "operator" : "ST_POINT", + "operand" : [ { + "operator" : "10.0", + "operand" : [ ], + "type" : "DECIMAL" + }, { + "operator" : "20.0", + "operand" : [ ], + "type" : "DECIMAL" + } ], + "type" : "GEOMETRY" + }, { + "operator" : "ST_POINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "GEOMETRY" + }, { + "operator" : "-2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "source" : { + "values" : { + "schema" : [ "VARCHAR", "INTEGER", "INTEGER", "VARCHAR", "BIGINT" ], + "content" : [ ] + } + } + } + } ], + "help" : [ "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), ST_POINT($2, $1), -2)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalValues(tuples=[[]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSpatialDWithinToHilbertZero.json b/tests/calcite/testSpatialDWithinToHilbertZero.json new file mode 100644 index 0000000..3f83d8d --- /dev/null +++ b/tests/calcite/testSpatialDWithinToHilbertZero.json @@ -0,0 +1,129 @@ +{ + "schemas" : [ { + "name" : "RESTAURANTS", + "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], + "types" : [ "VARCHAR", "INTEGER", "INTEGER", "VARCHAR", "BIGINT" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "ST_DWITHIN", + "operand" : [ { + "operator" : "ST_POINT", + "operand" : [ { + "operator" : "10.0", + "operand" : [ ], + "type" : "DECIMAL" + }, { + "operator" : "20.0", + "operand" : [ ], + "type" : "DECIMAL" + } ], + "type" : "GEOMETRY" + }, { + "operator" : "ST_POINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "GEOMETRY" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "33139", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "operator" : "POINT (10 20)", + "operand" : [ ], + "type" : "GEOMETRY" + }, { + "operator" : "ST_POINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "GEOMETRY" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ], + "help" : [ "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), ST_POINT($2, $1), 0)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(=($4, 33139), =(POINT (10 20), ST_POINT($2, $1)))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSpatialReduce.json b/tests/calcite/testSpatialReduce.json new file mode 100644 index 0000000..72ed1c4 --- /dev/null +++ b/tests/calcite/testSpatialReduce.json @@ -0,0 +1,58 @@ +{ + "schemas" : [ { + "name" : "RESTAURANTS", + "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], + "types" : [ "VARCHAR", "INTEGER", "INTEGER", "VARCHAR", "BIGINT" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "ST_BUFFER", + "operand" : [ { + "operator" : "ST_POINT", + "operand" : [ { + "operator" : "0.0", + "operand" : [ ], + "type" : "DECIMAL" + }, { + "operator" : "0.0", + "operand" : [ ], + "type" : "DECIMAL" + } ], + "type" : "GEOMETRY" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "GEOMETRY" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "operator" : "CAST", + "operand" : [ { + "operator" : "POLYGON ((1 0, 0.9238795325112867 -0.3826834323650898, 0.7071067811865476 -0.7071067811865475, 0.3826834323650898 -0.9238795325112867, 0.0000000000000001 -1, -0.3826834323650897 -0.9238795325112867, -0.7071067811865475 -0.7071067811865476, -0.9238795325112867 -0.3826834323650899, -1 -0.0000000000000001, -0.9238795325112868 0.3826834323650897, -0.7071067811865477 0.7071067811865475, -0.3826834323650903 0.9238795325112865, -0.0000000000000002 1, 0.38268343236509 0.9238795325112866, 0.7071067811865474 0.7071067811865477, 0.9238795325112865 0.3826834323650904, 1 0))", + "operand" : [ ], + "type" : "GEOMETRY" + } ], + "type" : "GEOMETRY" + } ], + "source" : { + "scan" : 0 + } + } + } ], + "help" : [ "LogicalProject(B=[ST_BUFFER(ST_POINT(0.0:DECIMAL(2, 1), 0.0:DECIMAL(2, 1)), 1, 4)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(B=[CAST(POLYGON ((1 0, 0.9238795325112867 -0.3826834323650898, 0.7071067811865476 -0.7071067811865475, 0.3826834323650898 -0.9238795325112867, 0.0000000000000001 -1, -0.3826834323650897 -0.9238795325112867, -0.7071067811865475 -0.7071067811865476, -0.9238795325112867 -0.3826834323650899, -1 -0.0000000000000001, -0.9238795325112868 0.3826834323650897, -0.7071067811865477 0.7071067811865475, -0.3826834323650903 0.9238795325112865, -0.0000000000000002 1, 0.38268343236509 0.9238795325112866, 0.7071067811865474 0.7071067811865477, 0.9238795325112865 0.3826834323650904, 1 0)):GEOMETRY):GEOMETRY])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testStrengthenJoinType.json b/tests/calcite/testStrengthenJoinType.json new file mode 100644 index 0000000..003b241 --- /dev/null +++ b/tests/calcite/testStrengthenJoinType.json @@ -0,0 +1,250 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 6, + "type" : "TIMESTAMP" + } ], + "type" : "TIMESTAMP" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 10, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "100", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalFilter(condition=[AND(IS NOT NULL($9), >($7, 100))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[CAST($2):INTEGER], ENAME=[CAST($3):VARCHAR(20)], JOB=[CAST($4):VARCHAR(10)], MGR=[$5], HIREDATE=[CAST($6):TIMESTAMP(0)], SAL=[CAST($7):INTEGER], COMM=[CAST($8):INTEGER], DEPTNO0=[CAST($9):INTEGER], SLACKER=[CAST($10):BOOLEAN])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSumAndDistinctSumWithExpandSumType.json b/tests/calcite/testSumAndDistinctSumWithExpandSumType.json new file mode 100644 index 0000000..30a5b02 --- /dev/null +++ b/tests/calcite/testSumAndDistinctSumWithExpandSumType.json @@ -0,0 +1,259 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "operator" : "CAST", + "operand" : [ { + "column" : 0, + "type" : "DECIMAL" + } ], + "type" : "BIGINT" + }, { + "column" : 1, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "DECIMAL" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[SUM(DISTINCT $0)])\n LogicalProject(COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[CAST($0):BIGINT], EXPR$1=[$1])\n LogicalAggregate(group=[{}], EXPR$0=[SUM($1)], EXPR$1=[SUM($0)])\n LogicalAggregate(group=[{0}], EXPR$0=[SUM($0)])\n LogicalProject(COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testSwapOuterJoin.json b/tests/calcite/testSwapOuterJoin.json new file mode 100644 index 0000000..be2f196 --- /dev/null +++ b/tests/calcite/testSwapOuterJoin.json @@ -0,0 +1,117 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 1 + }, + "right" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalProject(DEPTNO=[$9], NAME=[$10], EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO0=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($9, $7)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceAggregate.json b/tests/calcite/testTransitiveInferenceAggregate.json new file mode 100644 index 0000000..a1372a9 --- /dev/null +++ b/tests/calcite/testTransitiveInferenceAggregate.json @@ -0,0 +1,272 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceComplexPredicate.json b/tests/calcite/testTransitiveInferenceComplexPredicate.json new file mode 100644 index 0000000..6679dc7 --- /dev/null +++ b/tests/calcite/testTransitiveInferenceComplexPredicate.json @@ -0,0 +1,228 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "/", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "/", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[AND(>($7, 7), =($6, $7), >(+($6, $7), /($6, 2)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($5, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[AND(>($7, 7), =($6, $7), >(+($6, $7), /($6, 2)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalFilter(condition=[=($5, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceConjunctInPullUp.json b/tests/calcite/testTransitiveInferenceConjunctInPullUp.json new file mode 100644 index 0000000..4c40b71 --- /dev/null +++ b/tests/calcite/testTransitiveInferenceConjunctInPullUp.json @@ -0,0 +1,120 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "SEARCH", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "Sarg[7, 9, (10..+∞)]", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : "SEARCH", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "Sarg[7, 9, (10..+∞)]", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : "SEARCH", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "Sarg[7, 9, (10..+∞)]", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[SEARCH($7, Sarg[7, 9, (10..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[SEARCH($7, Sarg[7, 9, (10..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[SEARCH($7, Sarg[7, 9, (10..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceJoin.json b/tests/calcite/testTransitiveInferenceJoin.json new file mode 100644 index 0000000..0fed653 --- /dev/null +++ b/tests/calcite/testTransitiveInferenceJoin.json @@ -0,0 +1,120 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceJoin3way.json b/tests/calcite/testTransitiveInferenceJoin3way.json new file mode 100644 index 0000000..4c72605 --- /dev/null +++ b/tests/calcite/testTransitiveInferenceJoin3way.json @@ -0,0 +1,174 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 25, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "scan" : 0 + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 25, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($16, $25)], joinType=[inner])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($16, $25)], joinType=[inner])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceJoin3wayAgg.json b/tests/calcite/testTransitiveInferenceJoin3wayAgg.json new file mode 100644 index 0000000..27523d0 --- /dev/null +++ b/tests/calcite/testTransitiveInferenceJoin3wayAgg.json @@ -0,0 +1,326 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "scan" : 0 + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($9, $18)], joinType=[inner])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($9, $18)], joinType=[inner])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceLeftOuterJoin.json b/tests/calcite/testTransitiveInferenceLeftOuterJoin.json new file mode 100644 index 0000000..25cdfad --- /dev/null +++ b/tests/calcite/testTransitiveInferenceLeftOuterJoin.json @@ -0,0 +1,152 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "operator" : "9", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "operator" : "9", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($16, 9)])\n LogicalJoin(condition=[=($7, $16)], joinType=[left])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($16, 9)])\n LogicalJoin(condition=[=($7, $16)], joinType=[left])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceProject.json b/tests/calcite/testTransitiveInferenceProject.json new file mode 100644 index 0000000..78b1a53 --- /dev/null +++ b/tests/calcite/testTransitiveInferenceProject.json @@ -0,0 +1,184 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferencePullUpThruAlias.json b/tests/calcite/testTransitiveInferencePullUpThruAlias.json new file mode 100644 index 0000000..64e1ce8 --- /dev/null +++ b/tests/calcite/testTransitiveInferencePullUpThruAlias.json @@ -0,0 +1,136 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $8)], joinType=[inner])\n LogicalProject(DEPTNO=[$6])\n LogicalFilter(condition=[>($6, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $8)], joinType=[inner])\n LogicalProject(DEPTNO=[$6])\n LogicalFilter(condition=[>($6, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceRightOuterJoin.json b/tests/calcite/testTransitiveInferenceRightOuterJoin.json new file mode 100644 index 0000000..7574181 --- /dev/null +++ b/tests/calcite/testTransitiveInferenceRightOuterJoin.json @@ -0,0 +1,152 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "9", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "RIGHT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "9", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "9", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($7, 7)])\n LogicalJoin(condition=[=($7, $16)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 9)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($7, 7)])\n LogicalJoin(condition=[=($7, $16)], joinType=[right])\n LogicalFilter(condition=[>($7, 9)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 9)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceUnion.json b/tests/calcite/testTransitiveInferenceUnion.json new file mode 100644 index 0000000..86ae594 --- /dev/null +++ b/tests/calcite/testTransitiveInferenceUnion.json @@ -0,0 +1,192 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $8)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $8)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceUnion3way.json b/tests/calcite/testTransitiveInferenceUnion3way.json new file mode 100644 index 0000000..e898147 --- /dev/null +++ b/tests/calcite/testTransitiveInferenceUnion3way.json @@ -0,0 +1,248 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "union" : [ { + "union" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + }, + "right" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "union" : [ { + "union" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } ] + }, + "right" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $8)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $8)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceUnionAlwaysTrue.json b/tests/calcite/testTransitiveInferenceUnionAlwaysTrue.json new file mode 100644 index 0000000..46a281b --- /dev/null +++ b/tests/calcite/testTransitiveInferenceUnionAlwaysTrue.json @@ -0,0 +1,212 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "right" : { + "filter" : { + "condition" : { + "operator" : "<", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "7", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(DEPTNO=[$0], DEPTNO0=[$1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($7, 4)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], DEPTNO0=[$1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($7, 4)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[<($0, 4)])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json b/tests/calcite/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json new file mode 100644 index 0000000..b504754 --- /dev/null +++ b/tests/calcite/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json @@ -0,0 +1,534 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "correlate" : [ { + "scan" : 0 + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "50", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "50", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "correlate" : [ { + "scan" : 0 + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ ], + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "50", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "<", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "50", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "20", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 18, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + }, { + "operator" : "+", + "operand" : [ { + "operator" : "30", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[AND(<(+($0, 50), 20), >=($cor0.DEPTNO, +(30, $7)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(<(+($0, 50), 20), >=($cor0.DEPTNO, $9))])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+(30, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testUnionMergeRule.json b/tests/calcite/testUnionMergeRule.json new file mode 100644 index 0000000..983bddb --- /dev/null +++ b/tests/calcite/testUnionMergeRule.json @@ -0,0 +1,483 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "union" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } ] + } + } + } ] + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + }, { + "union" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } ], + "help" : [ "LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalUnion(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testUnionToDistinctRule.json b/tests/calcite/testUnionToDistinctRule.json new file mode 100644 index 0000000..4725514 --- /dev/null +++ b/tests/calcite/testUnionToDistinctRule.json @@ -0,0 +1,147 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "union" : [ { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } ] + } + } + } + } + } ] + } + } ], + "help" : [ "LogicalUnion(all=[false])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testWhereAnyCorrelatedInSelect.json b/tests/calcite/testWhereAnyCorrelatedInSelect.json new file mode 100644 index 0000000..b9a018f --- /dev/null +++ b/tests/calcite/testWhereAnyCorrelatedInSelect.json @@ -0,0 +1,423 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "> SOME", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + }, + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 11, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 12, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 13, + "type" : "VARCHAR" + } ], + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 13, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT TRUE", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 12, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT TRUE", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 12, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT TRUE", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT TRUE", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "column" : 11, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[> SOME($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], m=[CAST($9):INTEGER], c=[CAST($10):BIGINT], d=[CAST($11):BIGINT], trueLiteral=[CAST($12):BOOLEAN], NAME=[CAST($13):VARCHAR(10)])\n LogicalJoin(condition=[AND(=($2, $13), OR(AND(>($0, $9), IS NOT TRUE(OR(IS NULL($12), =($10, 0)))), AND(>($0, $9), IS NOT TRUE(OR(IS NULL($12), =($10, 0))), IS NOT TRUE(>($0, $9)), IS NOT TRUE(>($10, $11)))))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(m=[$1], c=[$2], d=[$2], trueLiteral=[true], NAME=[$0])\n LogicalAggregate(group=[{0}], m=[MIN($1)], c=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testWhereExpressionInCorrelated.json b/tests/calcite/testWhereExpressionInCorrelated.json new file mode 100644 index 0000000..cbe17fe --- /dev/null +++ b/tests/calcite/testWhereExpressionInCorrelated.json @@ -0,0 +1,244 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[IN($1, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[=(+($5, 1), $cor0.SALPLUS)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalProject(ENAME=[$1], DEPTNO=[$7], SALPLUS=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(ENAME=[$0])\n LogicalJoin(condition=[AND(=($2, $4), =($1, $3))], joinType=[inner])\n LogicalProject(ENAME=[$1], DEPTNO=[$7], SALPLUS=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], $f9=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testWhereExpressionInCorrelated2.json b/tests/calcite/testWhereExpressionInCorrelated2.json new file mode 100644 index 0000000..6936c66 --- /dev/null +++ b/tests/calcite/testWhereExpressionInCorrelated2.json @@ -0,0 +1,251 @@ +{ + "schemas" : [ { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "operator" : "+", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + }, + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "-", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "-", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + }, + "right" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "+", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalProject(NAME=[$0])\n LogicalFilter(condition=[IN($1, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[=(+($5, 1), $cor0.DEPTNOMINUS)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalProject(NAME=[$1], DEPTNO=[$0], DEPTNOMINUS=[-($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0])\n LogicalJoin(condition=[AND(=($2, $4), =($1, $3))], joinType=[inner])\n LogicalProject(NAME=[$1], DEPTNO=[$0], DEPTNOMINUS=[-($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], $f9=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testWhereInCorrelated.json b/tests/calcite/testWhereInCorrelated.json new file mode 100644 index 0000000..8737dc6 --- /dev/null +++ b/tests/calcite/testWhereInCorrelated.json @@ -0,0 +1,121 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + }, + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalJoin(condition=[AND(=($2, $10), =($0, $9))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testWhereInJoinCorrelated.json b/tests/calcite/testWhereInJoinCorrelated.json new file mode 100644 index 0000000..08180a1 --- /dev/null +++ b/tests/calcite/testWhereInJoinCorrelated.json @@ -0,0 +1,256 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "IN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 16, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 18, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "correlate" : [ { + "join" : { + "kind" : "INNER", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "scan" : 1 + } + } + }, { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 16, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 18, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 17, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 19, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } ] + } + } ] + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IN($5, {\nLogicalProject(SAL=[$5])\n LogicalFilter(condition=[>($7, $cor0.DEPTNO)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalFilter(condition=[=($5, $11)])\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{7}])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(SAL=[$5])\n LogicalFilter(condition=[>($7, $cor0.DEPTNO)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testWhereNotInCorrelated.json b/tests/calcite/testWhereNotInCorrelated.json new file mode 100644 index 0000000..9a3516e --- /dev/null +++ b/tests/calcite/testWhereNotInCorrelated.json @@ -0,0 +1,267 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "NOT", + "operand" : [ { + "operator" : "IN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 1 + } + } + } + } + }, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT TRUE", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 13, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "column" : 9, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 14, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[NOT(IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[OR(=($9, 0), IS NOT TRUE(OR(IS NOT NULL($13), <($10, $9))))])\n LogicalJoin(condition=[AND(=($0, $12), =($2, $14))], joinType=[left])\n LogicalJoin(condition=[=($2, $11)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(c=[$1], ck=[$1], NAME=[$0])\n LogicalAggregate(group=[{0}], c=[COUNT()])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], i=[true], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testWhereNotInCorrelated2.json b/tests/calcite/testWhereNotInCorrelated2.json new file mode 100644 index 0000000..68691d2 --- /dev/null +++ b/tests/calcite/testWhereNotInCorrelated2.json @@ -0,0 +1,427 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "NOT", + "operand" : [ { + "operator" : "IN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 14, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NOT TRUE", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "IS NOT NULL", + "operand" : [ { + "column" : 13, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "<", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "column" : 9, + "type" : "BIGINT" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 14, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + } ] + } + } + } + } + } + }, + "right" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : ">", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[NOT(IN($0, {\nLogicalProject(EMPNO=[$1])\n LogicalFilter(condition=[AND(>($2, 2), =($cor0.ENAME, $0))])\n LogicalProject(ENAME=[$1], EMPNO=[$0], R=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(=($9, 0), IS NOT TRUE(OR(IS NOT NULL($13), <($10, $9))))])\n LogicalJoin(condition=[AND(=($0, $12), =($1, $14))], joinType=[left])\n LogicalJoin(condition=[=($1, $11)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(c=[$1], ck=[$1], ENAME=[$0])\n LogicalAggregate(group=[{0}], c=[COUNT()])\n LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[>($2, 2)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], R=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$1], i=[true], ENAME=[$0])\n LogicalFilter(condition=[>($2, 2)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], R=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testWhereOrSubQuery.json b/tests/calcite/testWhereOrSubQuery.json new file mode 100644 index 0000000..f4fd362 --- /dev/null +++ b/tests/calcite/testWhereOrSubQuery.json @@ -0,0 +1,219 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + }, { + "name" : "DEPT", + "fields" : [ "DEPTNO", "NAME" ], + "types" : [ "INTEGER", "VARCHAR" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NOT", + "operand" : [ { + "operator" : "IN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "query" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 1 + } + } + }, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "OR", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "4", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 10, + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "join" : { + "kind" : "LEFT", + "condition" : { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, + "left" : { + "scan" : 0 + }, + "right" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "true", + "operand" : [ ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 1 + } + } + } + } + } + } + } + } + } + } + } ], + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(=($5, 4), NOT(IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(=($5, 4), IS NULL($10))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], i=[true])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testWithinDistinct.json b/tests/calcite/testWithinDistinct.json new file mode 100644 index 0000000..4af0d09 --- /dev/null +++ b/tests/calcite/testWithinDistinct.json @@ -0,0 +1,556 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "$THROW_UNLESS", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "<>", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "$SUM0", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "$THROW_UNLESS", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "<>", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[SUM($1) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], $f1=[CAST($1):INTEGER NOT NULL], $f2=[$2])\n LogicalAggregate(group=[{0}], agg#0=[MIN($1) FILTER $3], agg#1=[$SUM0($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f3=[$3], $f6=[=($5, 1)], $f7=[AND(=($5, 0), $THROW_UNLESS(OR(<>($5, 0), =($3, $4)), 'more than one distinct value in agg UNIQUE_VALUE'))])\n LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}]], agg#0=[$SUM0($1)], agg#1=[MIN($1)], agg#2=[MAX($1)], agg#3=[GROUPING($0, $2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testWithinDistinctCountDistinct.json b/tests/calcite/testWithinDistinctCountDistinct.json new file mode 100644 index 0000000..9dd4602 --- /dev/null +++ b/tests/calcite/testWithinDistinctCountDistinct.json @@ -0,0 +1,679 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "distinct" : true, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 6, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "VARCHAR" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "COUNT", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 7, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "VARCHAR" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "operator" : ">", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "1000", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], SS_C=[SUM($1) WITHIN DISTINCT ($2)], CDJ=[COUNT(DISTINCT $3)], CJ_J=[COUNT() WITHIN DISTINCT ($3)], CDJ_J=[COUNT(DISTINCT $3) WITHIN DISTINCT ($3)], CDJ_FILTERED=[COUNT(DISTINCT $3) FILTER $4])\n LogicalProject(DEPTNO=[$7], SAL=[$5], COMM=[$6], JOB=[$2], $f4=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], $f1=[$1], $f2=[$2], $f20=[$2], $f21=[$2], $f3=[$3])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[COUNT($2) FILTER $5])\n LogicalProject(DEPTNO=[$0], $f3=[$3], $f4=[$4], $f7=[=($6, 1)], $f8=[=($6, 2)], $f9=[AND(=($6, 2), >($5, 0))])\n LogicalAggregate(group=[{0, 2, 3}], groups=[[{0, 2}, {0, 3}]], agg#0=[MIN($1)], agg#1=[MIN($3) FILTER $4], agg#2=[COUNT() FILTER $4], agg#3=[GROUPING($0, $2, $3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], COMM=[$6], JOB=[$2], $f4=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testWithinDistinctFilteredAggs.json b/tests/calcite/testWithinDistinctFilteredAggs.json new file mode 100644 index 0000000..688b06e --- /dev/null +++ b/tests/calcite/testWithinDistinctFilteredAggs.json @@ -0,0 +1,1167 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "AVG", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "$THROW_UNLESS", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "<>", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "$THROW_UNLESS", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "<>", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "$SUM0", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "$THROW_UNLESS", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "<>", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "$THROW_UNLESS", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "<>", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 5, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($1) FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/($3, $4)):INTEGER])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $f2=[$2], $f3=[CASE(=($4, 0), null:INTEGER, $3)], $f4=[$4])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[$SUM0($2) FILTER $5], agg#3=[COUNT() FILTER $6])\n LogicalProject(DEPTNO=[$0], $f3=[$3], $f6=[$6], $f10=[AND(=($9, 2), >($5, 0), $THROW_UNLESS(OR(<>($9, 2), AND(IS NULL($3), IS NULL($4)), IS TRUE(=($3, $4))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f11=[AND(=($9, 2), >($5, 0))], $f12=[AND(=($9, 1), >($8, 0), $THROW_UNLESS(OR(<>($9, 1), AND(IS NULL($6), IS NULL($7)), IS TRUE(=($6, $7))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f13=[AND(=($9, 1), >($8, 0))])\n LogicalAggregate(group=[{0, 1, 3}], groups=[[{0, 1}, {0, 3}]], agg#0=[MIN($1) FILTER $2], agg#1=[MAX($1) FILTER $2], agg#2=[COUNT() FILTER $2], agg#3=[MIN($4) FILTER $5], agg#4=[MAX($4) FILTER $5], agg#5=[COUNT() FILTER $5], agg#6=[GROUPING($0, $1, $3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testWithinDistinctFilteredAggsSameFilter.json b/tests/calcite/testWithinDistinctFilteredAggsSameFilter.json new file mode 100644 index 0000000..7778bf1 --- /dev/null +++ b/tests/calcite/testWithinDistinctFilteredAggsSameFilter.json @@ -0,0 +1,1089 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "AVG", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "$THROW_UNLESS", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "<>", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "$THROW_UNLESS", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "<>", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "$SUM0", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "$THROW_UNLESS", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "<>", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "2", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "$THROW_UNLESS", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "<>", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 5, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, { + "column" : 6, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($1) FILTER $2])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[LIKE($1, '%ok%')], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/($3, $4)):INTEGER])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $f2=[$2], $f3=[CASE(=($4, 0), null:INTEGER, $3)], $f4=[$4])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[$SUM0($2) FILTER $5], agg#3=[COUNT() FILTER $6])\n LogicalProject(DEPTNO=[$0], $f3=[$3], $f6=[$6], $f9=[AND(=($8, 2), >($5, 0), $THROW_UNLESS(OR(<>($8, 2), AND(IS NULL($3), IS NULL($4)), IS TRUE(=($3, $4))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f10=[AND(=($8, 2), >($5, 0))], $f11=[AND(=($8, 1), >($5, 0), $THROW_UNLESS(OR(<>($8, 1), AND(IS NULL($6), IS NULL($7)), IS TRUE(=($6, $7))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f12=[AND(=($8, 1), >($5, 0))])\n LogicalAggregate(group=[{0, 1, 3}], groups=[[{0, 1}, {0, 3}]], agg#0=[MIN($1) FILTER $2], agg#1=[MAX($1) FILTER $2], agg#2=[COUNT() FILTER $2], agg#3=[MIN($4) FILTER $2], agg#4=[MAX($4) FILTER $2], agg#5=[GROUPING($0, $1, $3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[LIKE($1, '%ok%')], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testWithinDistinctFilteredAggsUniformDistinctKeys.json b/tests/calcite/testWithinDistinctFilteredAggsUniformDistinctKeys.json new file mode 100644 index 0000000..49901cf --- /dev/null +++ b/tests/calcite/testWithinDistinctFilteredAggsUniformDistinctKeys.json @@ -0,0 +1,963 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "AVG", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "$THROW_UNLESS", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "$THROW_UNLESS", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "$SUM0", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "$THROW_UNLESS", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "AND", + "operand" : [ { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "$THROW_UNLESS", + "operand" : [ { + "operator" : "OR", + "operand" : [ { + "operator" : "AND", + "operand" : [ { + "operator" : "IS NULL", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS NULL", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "IS TRUE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($3) FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/($3, $4)):INTEGER])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $f2=[$2], $f3=[CASE(=($4, 0), null:INTEGER, $3)], $f4=[$4])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[$SUM0($2) FILTER $5], agg#3=[COUNT() FILTER $6])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f5=[$5], $f8=[AND(>($4, 0), $THROW_UNLESS(OR(AND(IS NULL($2), IS NULL($3)), IS TRUE(=($2, $3))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f9=[>($4, 0)], $f10=[AND(>($7, 0), $THROW_UNLESS(OR(AND(IS NULL($5), IS NULL($6)), IS TRUE(=($5, $6))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f11=[>($7, 0)])\n LogicalAggregate(group=[{0, 3}], agg#0=[MIN($1) FILTER $2], agg#1=[MAX($1) FILTER $2], agg#2=[COUNT() FILTER $2], agg#3=[MIN($4) FILTER $5], agg#4=[MAX($4) FILTER $5], agg#5=[COUNT() FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json b/tests/calcite/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json new file mode 100644 index 0000000..4552991 --- /dev/null +++ b/tests/calcite/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json @@ -0,0 +1,691 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "AVG", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "operator" : "CASE", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "NULL", + "operand" : [ ], + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "$SUM0", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : ">", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "operator" : ">", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "10", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "operator" : "LIKE", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + }, { + "operator" : "_ISO-8859-1'%ok%'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($3) FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/($3, $4)):INTEGER])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $f2=[$2], $f3=[CASE(=($4, 0), null:INTEGER, $3)], $f4=[$4])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $3], agg#2=[$SUM0($2) FILTER $4], agg#3=[COUNT() FILTER $4])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f4=[$4], $f6=[>($3, 0)], $f7=[>($5, 0)])\n LogicalAggregate(group=[{0, 3}], agg#0=[MIN($1) FILTER $2], agg#1=[COUNT() FILTER $2], agg#2=[MIN($4) FILTER $5], agg#3=[COUNT() FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testWithinDistinctNoThrow.json b/tests/calcite/testWithinDistinctNoThrow.json new file mode 100644 index 0000000..4696d6f --- /dev/null +++ b/tests/calcite/testWithinDistinctNoThrow.json @@ -0,0 +1,464 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "$SUM0", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "1", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "operator" : "0", + "operand" : [ ], + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "GROUPING", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[SUM($1) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], $f1=[CAST($1):INTEGER NOT NULL], $f2=[$2])\n LogicalAggregate(group=[{0}], agg#0=[MIN($1) FILTER $3], agg#1=[$SUM0($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f3=[$3], $f5=[=($4, 1)], $f6=[=($4, 0)])\n LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}]], agg#0=[$SUM0($1)], agg#1=[MIN($1)], agg#2=[GROUPING($0, $2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testWithinDistinctUniformDistinctKeys.json b/tests/calcite/testWithinDistinctUniformDistinctKeys.json new file mode 100644 index 0000000..51b64db --- /dev/null +++ b/tests/calcite/testWithinDistinctUniformDistinctKeys.json @@ -0,0 +1,535 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "AVG", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "operator" : "$THROW_UNLESS", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "$THROW_UNLESS", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "$SUM0", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "operator" : "$THROW_UNLESS", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "$THROW_UNLESS", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", + "operand" : [ ], + "type" : "CHAR" + } ], + "type" : "BOOLEAN" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MAX", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($2)], EXPR$2=[AVG($3) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[$SUM0($2) FILTER $4], agg#2=[COUNT()])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f4=[$4], $f6=[$THROW_UNLESS(=($2, $3), 'more than one distinct value in agg UNIQUE_VALUE')], $f7=[$THROW_UNLESS(=($4, $5), 'more than one distinct value in agg UNIQUE_VALUE')])\n LogicalAggregate(group=[{0, 2}], agg#0=[MIN($1)], agg#1=[MAX($1)], agg#2=[MIN($3)], agg#3=[MAX($3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file diff --git a/tests/calcite/testWithinDistinctUniformDistinctKeysNoThrow.json b/tests/calcite/testWithinDistinctUniformDistinctKeysNoThrow.json new file mode 100644 index 0000000..a06b07c --- /dev/null +++ b/tests/calcite/testWithinDistinctUniformDistinctKeysNoThrow.json @@ -0,0 +1,399 @@ +{ + "schemas" : [ { + "name" : "EMP", + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], + "key" : [ [ 0 ] ], + "foreign" : [ ] + } ], + "queries" : [ { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "SUM", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "AVG", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + }, { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "operator" : "CAST", + "operand" : [ { + "operator" : "/", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "type" : "BIGINT" + } ], + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "$SUM0", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "$SUM0", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "COUNT", + "operand" : [ ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "BIGINT" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "distinct" : { + "correlate" : [ { + "project" : { + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "source" : { + "project" : { + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + }, { + "aggregate" : { + "function" : [ { + "operator" : "MIN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + }, { + "operator" : "MIN", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "distinct" : false, + "ignoreNulls" : false, + "type" : "INTEGER" + } ], + "source" : { + "filter" : { + "condition" : { + "operator" : "AND", + "operand" : [ { + "operator" : "=", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "type" : "BOOLEAN" + }, { + "operator" : "=", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + } ], + "type" : "BOOLEAN" + } ], + "type" : "BOOLEAN" + }, + "source" : { + "project" : { + "target" : [ { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + } ] + } + } + } + } + } + } ] + } + } + } + } ], + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($2)], EXPR$2=[AVG($3) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($2)], agg#1=[$SUM0($3)], agg#2=[COUNT()])\n LogicalAggregate(group=[{0, 2}], agg#0=[MIN($1)], agg#1=[MIN($3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] +} \ No newline at end of file From 4207948750c93890c8ae2c074838d12c0ee393ef Mon Sep 17 00:00:00 2001 From: Shuxian Wang Date: Sun, 20 Aug 2023 15:53:38 -0700 Subject: [PATCH 07/11] Handle inequalities better. --- Cargo.lock | 8 ++++---- src/pipeline/normal.rs | 17 +++++++++++++++-- src/pipeline/null.rs | 4 ++++ src/pipeline/stable.rs | 19 ++++++------------- src/pipeline/unify.rs | 6 ++++-- 5 files changed, 33 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e3909e0..d6c9dfd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -531,9 +531,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83d3daa6976cffb758ec878f108ba0e062a45b2d6ca3a2cca965338855476caf" +checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" dependencies = [ "aho-corasick", "memchr", @@ -727,7 +727,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "z3" version = "0.11.2" -source = "git+https://github.com/wsx-ucb/z3.rs?branch=add-binding#b667c153578d61347b7607d672f84a65a17af5b2" +source = "git+https://github.com/wsx-ucb/z3.rs?branch=add-binding#255189446ce4ac65627229ce3bd5e97d7d781cec" dependencies = [ "log", "z3-sys", @@ -736,7 +736,7 @@ dependencies = [ [[package]] name = "z3-sys" version = "0.7.1" -source = "git+https://github.com/wsx-ucb/z3.rs?branch=add-binding#b667c153578d61347b7607d672f84a65a17af5b2" +source = "git+https://github.com/wsx-ucb/z3.rs?branch=add-binding#255189446ce4ac65627229ce3bd5e97d7d781cec" dependencies = [ "bindgen", ] diff --git a/src/pipeline/normal.rs b/src/pipeline/normal.rs index 85a5faa..76a1a50 100644 --- a/src/pipeline/normal.rs +++ b/src/pipeline/normal.rs @@ -120,8 +120,10 @@ impl Expr { match self { Expr::Log(l) => l.exprs(), Expr::Op(op, es, ty) - if matches!(op.as_str(), "=" | "EQ") - && es.len() == 2 && ty == &DataType::Boolean => + if matches!( + op.as_str(), + "=" | "EQ" | "<=" | "LE" | "<" | "LT" | ">=" | "GE" | ">" | "GT" + ) && es.len() == 2 && ty == &DataType::Boolean => { es.iter().collect() }, @@ -610,6 +612,17 @@ impl<'c> Eval<&Expr, Dynamic<'c>> for &Z3Env<'c> { _ => unreachable!(), } }, + cmp @ (">" | "GT" | "<" | "LT" | ">=" | "GE" | "<=" | "LE") + if expr_args[0].ty() == String => + { + match cmp { + ">" | "GT" => ctx.string_gt(args[0], args[1]), + "<" | "LT" => ctx.string_lt(args[0], args[1]), + ">=" | "GE" => ctx.string_ge(args[0], args[1]), + "<=" | "LE" => ctx.string_le(args[0], args[1]), + _ => unreachable!(), + } + }, cmp @ ("=" | "EQ" | "<>" | "!=" | "NE") => { let (a1, a2) = (args[0], args[1]); assert_eq!( diff --git a/src/pipeline/null.rs b/src/pipeline/null.rs index 8b89e6d..703ad02 100644 --- a/src/pipeline/null.rs +++ b/src/pipeline/null.rs @@ -151,6 +151,10 @@ ctx_impl!( contains(x, y) -> Bool; prefix(x, y) -> Bool; suffix(x, y) -> Bool; + lt(x, y) -> Bool; + le(x, y) -> Bool; + gt(x, y) -> Bool; + ge(x, y) -> Bool; _eq(x, y) -> Bool; }; ); diff --git a/src/pipeline/stable.rs b/src/pipeline/stable.rs index 1a38594..fe47b54 100644 --- a/src/pipeline/stable.rs +++ b/src/pipeline/stable.rs @@ -208,8 +208,9 @@ pub fn stablize<'c>( let vars = shared::Expr::vars(subst.len(), scope.clone()); let exprs = vars .iter() - .chain(logic.exprs()) + .chain(logic.exprs().into_iter().unique()) .filter(|e| e.in_scope(subst.len() + scope.len())) + .unique() .collect_vec(); let z3_asts = exprs.iter().map(|&e| z3_env.eval(e)).collect_vec(); let z3_asts = z3_asts.iter().map(|e| e as &dyn Ast).collect_vec(); @@ -217,29 +218,21 @@ pub fn stablize<'c>( solver.assert(&constraint); let handle = solver.get_context().handle(); let checked = crossbeam::atomic::AtomicCell::new(false); - let interrupted = crossbeam::atomic::AtomicCell::new(false); - let (ids, res) = crossbeam::thread::scope(|s| { + let (ids, res) = std::thread::scope(|s| { let checked = &checked; - let interrupted = &interrupted; let p = crossbeam::sync::Parker::new(); let u = p.unparker().clone(); - s.spawn(move |_| { + s.spawn(move || { p.park_timeout(Ctx::timeout()); if !checked.load() { handle.interrupt(); - interrupted.store(true); } }); let (ids, res) = solver.get_implied_equalities(z3_asts.as_slice()); checked.store(true); u.unpark(); - if interrupted.load() { - (vec![], SatResult::Unknown) - } else { - (ids, res) - } - }) - .unwrap(); + (ids, res) + }); solver.pop(1); match res { SatResult::Unsat => None, diff --git a/src/pipeline/unify.rs b/src/pipeline/unify.rs index fd81680..8d197d9 100644 --- a/src/pipeline/unify.rs +++ b/src/pipeline/unify.rs @@ -224,8 +224,10 @@ pub(crate) fn smt<'c>(solver: &'c z3::Solver, pred: Bool<'c>) -> bool { .replace("(+ ", "(+ 0 "); let smt = smt.strip_prefix("; \n(set-info :status )").unwrap_or(smt.as_str()); let res = crossbeam::atomic::AtomicCell::new(false); + let last = crossbeam::atomic::AtomicCell::new(false); crossbeam::thread::scope(|s| { let res = &res; + let last = &last; let p = crossbeam::sync::Parker::new(); let u1 = p.unparker().clone(); let u2 = p.unparker().clone(); @@ -253,7 +255,7 @@ pub(crate) fn smt<'c>(solver: &'c z3::Solver, pred: Bool<'c>) -> bool { log::info!("Z3 result: {}", result); let provable = result.starts_with("unsat\n"); res.fetch_or(provable); - if result.starts_with("unsat\n") || result.starts_with("sat\n") { + if result.starts_with("unsat\n") || result.starts_with("sat\n") || last.fetch_or(true) { u1.unpark(); } }); @@ -266,7 +268,7 @@ pub(crate) fn smt<'c>(solver: &'c z3::Solver, pred: Bool<'c>) -> bool { log::info!("CVC5 result: {}", result); let provable = result.ends_with("unsat\n"); res.fetch_or(provable); - if result.starts_with("unsat\n") || result.starts_with("sat\n") { + if result.starts_with("unsat\n") || result.starts_with("sat\n") || last.fetch_or(true) { u2.unpark(); } }); From 82db6db977390a8c25228e408e357b27f17dee16 Mon Sep 17 00:00:00 2001 From: Shuxian Wang Date: Tue, 29 Aug 2023 07:59:56 -0400 Subject: [PATCH 08/11] Allow equality between expressions of generic type. --- src/pipeline/normal.rs | 2 +- src/pipeline/null.rs | 16 ++++++++++++++++ src/pipeline/shared.rs | 7 +++++-- src/pipeline/stable.rs | 2 +- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/pipeline/normal.rs b/src/pipeline/normal.rs index 76a1a50..9913dce 100644 --- a/src/pipeline/normal.rs +++ b/src/pipeline/normal.rs @@ -637,7 +637,7 @@ impl<'c> Eval<&Expr, Dynamic<'c>> for &Z3Env<'c> { Real => ctx.real__eq(a1, a2), Boolean => ctx.bool__eq(a1, a2), String => ctx.string__eq(a1, a2), - Custom(_) => todo!("Cannot compare between arbitrary types yet."), + Custom(ty) => ctx.generic_eq(ty, a1, a2), }; if cmp == "=" || cmp == "EQ" { eq diff --git a/src/pipeline/null.rs b/src/pipeline/null.rs index 703ad02..83f4900 100644 --- a/src/pipeline/null.rs +++ b/src/pipeline/null.rs @@ -273,4 +273,20 @@ impl<'c> Ctx<'c> { ), ) } + + pub fn generic_none(&self, ty: impl ToString) -> Dynamic<'c> { + Dynamic::new_const( + self.solver.get_context(), + format!("null!{}", ty.to_string()), + &self.generic_sort(ty), + ) + } + + pub fn generic_eq(&self, ty: impl ToString, e1: &Dynamic<'c>, e2: &Dynamic<'c>) -> Dynamic<'c> { + let none = self.generic_none(ty); + none._eq(e1).ite( + &self.bool_none(), + &none._eq(e2).ite(&self.bool_none(), &self.bool_some(e1._eq(e2))), + ) + } } diff --git a/src/pipeline/shared.rs b/src/pipeline/shared.rs index 7bb3bc2..c0d664f 100644 --- a/src/pipeline/shared.rs +++ b/src/pipeline/shared.rs @@ -467,17 +467,20 @@ impl<'c> Ctx<'c> { } pub fn sort(&self, ty: &DataType) -> Sort<'c> { - let z3_ctx = self.z3_ctx(); use DataType::*; match ty { Boolean => self.bool.sort.clone(), String => self.string.sort.clone(), Integer => self.int.sort.clone(), Real => self.real.sort.clone(), - Custom(ty) => Sort::uninterpreted(z3_ctx, z3::Symbol::String(ty.clone())), + Custom(ty) => self.generic_sort(ty), } } + pub fn generic_sort(&self, ty: impl ToString) -> Sort<'c> { + Sort::uninterpreted(self.z3_ctx(), z3::Symbol::String(ty.to_string())) + } + pub fn strict_sort(&self, ty: &DataType) -> Sort<'c> { let z3_ctx = self.z3_ctx(); use DataType::*; diff --git a/src/pipeline/stable.rs b/src/pipeline/stable.rs index fe47b54..5c5453c 100644 --- a/src/pipeline/stable.rs +++ b/src/pipeline/stable.rs @@ -208,7 +208,7 @@ pub fn stablize<'c>( let vars = shared::Expr::vars(subst.len(), scope.clone()); let exprs = vars .iter() - .chain(logic.exprs().into_iter().unique()) + .chain(logic.exprs()) .filter(|e| e.in_scope(subst.len() + scope.len())) .unique() .collect_vec(); From 2bbe318c4aa4dd9a5d1450cb2570734a4d0f377a Mon Sep 17 00:00:00 2001 From: Shuxian Wang Date: Tue, 29 Aug 2023 08:06:22 -0400 Subject: [PATCH 09/11] Update dependencies. --- Cargo.lock | 253 +++++++++++++++++++++++++++++++++++++++-------------- Cargo.toml | 4 +- 2 files changed, 188 insertions(+), 69 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d6c9dfd..0ed29c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,29 +4,18 @@ version = 3 [[package]] name = "aho-corasick" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" dependencies = [ "memchr", ] [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "autocfg" @@ -46,7 +35,7 @@ version = "0.64.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cexpr", "clang-sys", "lazy_static", @@ -66,12 +55,27 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" + [[package]] name = "bitmaps" version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "703642b98a00b3b90513279a8ede3fcfa479c126c5fb46e78f3051522f021403" +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + [[package]] name = "cexpr" version = "0.6.0" @@ -224,23 +228,44 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "env_logger" -version = "0.9.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" dependencies = [ - "atty", "humantime", + "is-terminal", "log", "regex", "termcolor", ] +[[package]] +name = "errno" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "fnv" version = "1.0.7" @@ -255,12 +280,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "hermit-abi" -version = "0.1.19" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "humantime" @@ -276,8 +298,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "imbl" -version = "2.0.1" -source = "git+https://github.com/jneem/imbl?branch=main#8756e765d8f76688da333b751db14287ae862c20" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85b4555023847ca2cd6fd11f20b553886e6981c7e8aee9b3e7e960b4b17fb440" dependencies = [ "bitmaps", "imbl-sized-chunks", @@ -301,6 +324,17 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys", +] + [[package]] name = "isoperm" version = "0.1.2" @@ -321,9 +355,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "lazy_static" @@ -353,17 +387,23 @@ dependencies = [ "winapi", ] +[[package]] +name = "linux-raw-sys" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" + [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "76fc44e2588d5b436dbc3c6cf62aef290f90dab6235744a93dfe1cc18f451e2c" [[package]] name = "memoffset" @@ -406,9 +446,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ "autocfg", "num-integer", @@ -417,9 +457,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" +checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" dependencies = [ "num-traits", ] @@ -459,18 +499,18 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", ] [[package]] name = "paste" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4b27ab7be369122c218afc2079489cdcb4b517c0a3fc386ff11e1fedfcc2b35" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "peeking_take_while" @@ -486,18 +526,18 @@ checksum = "d9978962f8a4b158e97447a6d09d2d75e206d2994eff056c894019f362b27142" [[package]] name = "proc-macro2" -version = "1.0.64" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.29" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -519,9 +559,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.1" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" +checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" dependencies = [ "aho-corasick", "memchr", @@ -531,9 +571,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.3" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" +checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" dependencies = [ "aho-corasick", "memchr", @@ -542,9 +582,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "rustc-hash" @@ -552,11 +592,24 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustix" +version = "0.38.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed6248e1caa625eb708e266e06159f135e8c26f2bb7ceb72dc4b2766d0340964" +dependencies = [ + "bitflags 2.4.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "ryu" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "same-file" @@ -569,15 +622,15 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.171" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] @@ -614,20 +667,20 @@ checksum = "794e44574226fc701e3be5c651feb7939038fc67fb73f6f4dd5c4ba90fd3be70" [[package]] name = "serde_derive" -version = "1.0.171" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.29", ] [[package]] name = "serde_json" -version = "1.0.102" +version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5062a995d481b2308b6064e9af76011f2921c35f97b0468811ed9f6cd91dfed" +checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" dependencies = [ "itoa", "ryu", @@ -653,9 +706,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.25" +version = "2.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2" +checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" dependencies = [ "proc-macro2", "quote", @@ -673,9 +726,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "version_check" @@ -724,6 +777,72 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "z3" version = "0.11.2" diff --git a/Cargo.toml b/Cargo.toml index 7a410b3..8339f12 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,8 +18,8 @@ permutation = "0.2" paste = "1.0" indenter = "0.3" log = "0.4" -env_logger = "0.9" -imbl = { git = "https://github.com/jneem/imbl", branch = "main" } +env_logger = "0.10" +imbl = "2.0" anyhow = "1.0" num = "0.4" crossbeam = "0.8" From ce8a8afb863c4909e460314663cb89a6456be40b Mon Sep 17 00:00:00 2001 From: Shuxian Wang Date: Tue, 17 Oct 2023 22:08:44 -0400 Subject: [PATCH 10/11] Update input format. --- Cargo.lock | 134 +- Cargo.toml | 2 +- flake.lock | 97 +- flake.nix | 14 +- src/pipeline/normal.rs | 11 +- src/pipeline/relation.rs | 183 +- .../calcite/testAddRedundantSemiJoinRule.json | 66 +- tests/calcite/testAggregateCaseToFilter.json | 1382 ++++------- .../calcite/testAggregateConstantKeyRule.json | 293 +-- .../testAggregateConstantKeyRule3.json | 359 +-- .../calcite/testAggregateDynamicFunction.json | 359 +-- .../testAggregateExtractProjectRule.json | 128 +- ...ateExtractProjectRuleWithGroupingSets.json | 200 +- ...teExtractProjectRuleWithGroupingSets2.json | 193 +- ...testAggregateGroupingSetsProjectMerge.json | 236 +- tests/calcite/testAggregateJoinRemove1.json | 179 +- tests/calcite/testAggregateJoinRemove10.json | 346 +-- tests/calcite/testAggregateJoinRemove11.json | 224 +- tests/calcite/testAggregateJoinRemove2.json | 224 +- tests/calcite/testAggregateJoinRemove3.json | 257 +-- tests/calcite/testAggregateJoinRemove4.json | 142 +- tests/calcite/testAggregateJoinRemove5.json | 226 +- tests/calcite/testAggregateJoinRemove6.json | 257 +-- tests/calcite/testAggregateJoinRemove7.json | 255 +- tests/calcite/testAggregateJoinRemove8.json | 300 +-- tests/calcite/testAggregateJoinRemove9.json | 294 +-- tests/calcite/testAggregateMerge1.json | 466 ++-- tests/calcite/testAggregateMerge2.json | 411 +--- tests/calcite/testAggregateMerge8.json | 230 +- tests/calcite/testAggregateMergeSum0.json | 226 +- tests/calcite/testAggregateProjectMerge.json | 236 +- .../testAggregateProjectPullUpConstants.json | 325 +-- .../testAggregateProjectPullUpConstants2.json | 200 +- tests/calcite/testAggregateRemove1.json | 263 +-- tests/calcite/testAggregateRemove2.json | 104 +- tests/calcite/testAggregateRemove3.json | 163 +- tests/calcite/testAggregateRemove7.json | 464 +--- ...egateUnionTransposeWithOneInputUnique.json | 938 ++------ ...ransposeWithTopLevelGroupSetRemapping.json | 848 ++----- tests/calcite/testAll.json | 369 ++- .../testAlreadyFalseEliminatesFilter.json | 42 +- .../testAntiCorrelateWithLeftEmpty.json | 45 + .../testAntiCorrelateWithRightEmpty.json | 27 + .../calcite/testAntiJoinProjectTranspose.json | 247 +- .../calcite/testAnyInProjectNonNullable.json | 287 ++- tests/calcite/testAnyInProjectNullable.json | 355 ++- ...ReuseDistinctAttrWithMixedOptionality.json | 309 +-- ...ReuseDistinctAttrWithMixedOptionality.json | 309 +-- .../calcite/testCasePushIsAlwaysWorking.json | 86 +- ...AggregateExpandDistinctAggregatesRule.json | 934 ++------ .../testCastInAggregateReduceFunctions.json | 481 ++-- ...estCorrelateWithoutCorrelationToEmpty.json | 132 ++ ...omColumnResolvingInCorrelatedSubQuery.json | 360 ++- ...mColumnResolvingInCorrelatedSubQuery2.json | 274 +-- ...olumnResolvingInNonCorrelatedSubQuery.json | 219 +- ...estDecorrelateAggWithConstantGroupKey.json | 657 ++---- tests/calcite/testDecorrelateExists.json | 179 +- tests/calcite/testDecorrelateTwoExists.json | 334 +-- tests/calcite/testDecorrelateTwoIn.json | 150 +- ...lateUncorrelatedInAndCorrelatedExists.json | 316 +-- ...estOfApproximateDistinctAggregateCall.json | 346 +-- tests/calcite/testDistinctCount1.json | 271 +-- tests/calcite/testDistinctCount2.json | 522 ++--- tests/calcite/testDistinctCount3.json | 469 ++-- .../testDistinctCountGroupingSets1.json | 483 +--- .../testDistinctCountGroupingSets2.json | 622 ++--- tests/calcite/testDistinctCountMixed.json | 535 ++--- tests/calcite/testDistinctCountMixed2.json | 651 ++---- tests/calcite/testDistinctCountMixedJoin.json | 831 ++----- tests/calcite/testDistinctCountMultiple.json | 511 ++-- .../testDistinctCountMultipleNoGroup.json | 384 +--- .../testDistinctCountMultipleViaJoin.json | 831 ++----- .../testDistinctCountWithExpandSumType.json | 281 +-- .../testDistinctCountWithoutGroupBy.json | 371 +-- .../testDistinctNonDistinctAggregates.json | 498 +--- ...nctNonDistinctAggregatesWithGrouping1.json | 499 ++-- ...nctNonDistinctAggregatesWithGrouping2.json | 360 +-- ...tNonDistinctTwoAggregatesWithGrouping.json | 444 +--- ...istinctWithDiffFiltersAndSameGroupSet.json | 577 ++--- .../testDistinctWithFilterAndGroupBy.json | 674 ++---- .../testDistinctWithFilterWithoutGroupBy.json | 563 ++--- tests/calcite/testDistinctWithGrouping.json | 393 +--- .../testDistinctWithMultipleInputs.json | 487 +--- ...tDistinctWithMultipleInputsAndGroupby.json | 497 +--- tests/calcite/testEmptyAggregate.json | 86 +- ...regateEmptyKeyWithAggregateValuesRule.json | 78 +- .../calcite/testEmptyFilterProjectUnion.json | 100 +- tests/calcite/testEmptyIntersect.json | 86 +- tests/calcite/testEmptyMinus.json | 132 +- tests/calcite/testEmptyMinus2.json | 318 ++- tests/calcite/testEmptyProject.json | 70 +- tests/calcite/testEmptyProject2.json | 70 +- tests/calcite/testEmptySort.json | 46 +- tests/calcite/testEmptySort2.json | 10 +- tests/calcite/testEmptySortLimitZero.json | 31 +- tests/calcite/testEmptyTable.json | 33 + ...ansformsComplexQueryToSingleTableScan.json | 122 + .../testExistsWithAtLeastOneRowSubQuery.json | 157 +- .../calcite/testExistsWithNoRowSubQuery.json | 48 +- ...ConstantInCorrelatedWithTwoSubQueries.json | 460 ++++ ...pandFilterConstantInWithTwoSubQueries.json | 429 ++++ tests/calcite/testExpandFilterExists.json | 240 +- .../calcite/testExpandFilterExistsSimple.json | 204 +- .../testExpandFilterExistsSimpleAnd.json | 232 +- tests/calcite/testExpandFilterIn.json | 278 +-- tests/calcite/testExpandFilterIn3Value.json | 685 +++--- .../calcite/testExpandFilterInComposite.json | 208 +- ...ndFilterInCorrelatedWithTwoSubQueries.json | 601 +++++ .../testExpandFilterInWithTwoSubQueries.json | 486 ++++ tests/calcite/testExpandFilterScalar.json | 382 ++- tests/calcite/testExpandJoinExists.json | 242 +- tests/calcite/testExpandJoinScalar.json | 460 ++-- tests/calcite/testExpandProjectExists.json | 166 +- tests/calcite/testExpandProjectIn.json | 228 +- .../calcite/testExpandProjectInComposite.json | 158 +- .../calcite/testExpandProjectInNullable.json | 631 ++--- .../testExpandProjectInWithTwoSubQueries.json | 443 ++++ tests/calcite/testExpandProjectScalar.json | 171 +- .../testExpandWhereComparisonCorrelated.json | 308 +-- .../testExpressionSimplification1.json | 108 +- .../testExpressionSimplification2.json | 134 +- tests/calcite/testExtractJoinFilterRule.json | 64 +- .../calcite/testExtractYearMonthToRange.json | 132 +- tests/calcite/testExtractYearToRange.json | 92 +- .../testFilterJoinRuleAndIsNotNull.json | 176 +- .../testFilterJoinRuleOrIsNotNull.json | 176 +- tests/calcite/testFilterProjectTranspose.json | 394 ++-- ...testFilterRemoveIsNotDistinctFromRule.json | 30 +- ...estFlattenUncorrelatedCallBelowEquals.json | 537 ++--- ...elatedTwoLevelCallBelowEqualsSucceeds.json | 577 ++--- ...estFullOuterJoinSimplificationToInner.json | 224 +- ...ullOuterJoinSimplificationToLeftOuter.json | 148 +- ...llOuterJoinSimplificationToRightOuter.json | 172 +- .../testGroupByBooleanLiteralSimple.json | 269 +-- .../calcite/testGroupByDateLiteralSimple.json | 269 +-- .../calcite/testGroupByMultipleLiterals.json | 520 ++--- ...dicatesWithNotOperatorInJoinCondition.json | 208 +- .../testInnerCorrelateWithLeftEmpty.json | 45 + .../testInnerCorrelateWithRightEmpty.json | 30 + tests/calcite/testIntersectToDistinct.json | 2048 +++-------------- ...eWithBottomAlwaysTrueConditionAllowed.json | 66 +- ...RuleWithTopAlwaysTrueConditionAllowed.json | 58 +- ...uteRuleWithAlwaysTrueConditionAllowed.json | 64 +- tests/calcite/testJoinConditionPushdown1.json | 194 +- tests/calcite/testJoinConditionPushdown2.json | 132 +- tests/calcite/testJoinConditionPushdown4.json | 108 +- tests/calcite/testJoinConditionPushdown6.json | 128 +- .../testJoinDeriveIsNotNullFilterRule1.json | 54 +- .../testJoinDeriveIsNotNullFilterRule12.json | 70 +- .../testJoinDeriveIsNotNullFilterRule15.json | 120 + .../testJoinDeriveIsNotNullFilterRule2.json | 114 +- .../testJoinDeriveIsNotNullFilterRule3.json | 54 +- .../testJoinDeriveIsNotNullFilterRule4.json | 86 +- .../testJoinDeriveIsNotNullFilterRule5.json | 122 +- tests/calcite/testJoinProjectTranspose1.json | 114 +- tests/calcite/testJoinProjectTranspose7.json | 88 +- tests/calcite/testJoinProjectTranspose8.json | 144 +- .../testJoinProjectTransposeWindow.json | 170 +- ...testJoinPushTransitivePredicatesRule2.json | 1576 ++++--------- .../testLeftCorrelateWithBothEmpty1.json | 67 + .../testLeftCorrelateWithBothEmpty2.json | 26 + .../testLeftCorrelateWithBothEmpty3.json | 67 + .../testLeftCorrelateWithLeftEmpty.json | 45 + .../testLeftCorrelateWithRightEmpty.json | 68 + tests/calcite/testLeftEmptyAntiJoin.json | 40 +- tests/calcite/testLeftEmptyFullJoin.json | 207 +- tests/calcite/testLeftEmptyInnerJoin.json | 136 +- tests/calcite/testLeftEmptyLeftJoin.json | 136 +- tests/calcite/testLeftEmptyRightJoin.json | 203 +- tests/calcite/testLeftEmptySemiJoin.json | 40 +- ...estLeftOuterJoinSimplificationToInner.json | 172 +- ...ReuseDistinctAttrWithMixedOptionality.json | 309 +-- tests/calcite/testMergeFilter.json | 90 +- tests/calcite/testMergeIntersect.json | 170 +- tests/calcite/testMergeJoinFilter.json | 122 +- tests/calcite/testMergeMinus.json | 452 ++-- tests/calcite/testMergeUnionAll.json | 170 +- tests/calcite/testMergeUnionDistinct.json | 174 +- tests/calcite/testMergeUnionMixed2.json | 174 +- ...ReuseDistinctAttrWithMixedOptionality.json | 309 +-- tests/calcite/testMinusMergeRule.json | 562 ----- .../testMultipleDistinctWithGrouping.json | 697 ++---- .../testNoOversimplificationBelowIsNull.json | 174 +- tests/calcite/testOrAlwaysTrue.json | 228 +- tests/calcite/testOrAlwaysTrue2.json | 228 +- .../testOversimplifiedCaseStatement.json | 162 +- tests/calcite/testProjectAggregateMerge.json | 288 +-- .../testProjectAggregateMergeSum0.json | 174 +- .../testProjectAggregateMergeSum0AndSum.json | 220 +- ...ctCorrelateTransposeRuleAntiCorrelate.json | 188 +- ...ctCorrelateTransposeRuleLeftCorrelate.json | 362 ++- ...ctCorrelateTransposeRuleSemiCorrelate.json | 188 +- ...jectFilterTransposeRuleOnEmptyRowType.json | 46 +- tests/calcite/testProjectJoinRemove1.json | 70 +- tests/calcite/testProjectJoinRemove10.json | 54 +- tests/calcite/testProjectJoinRemove4.json | 48 +- tests/calcite/testProjectJoinRemove7.json | 48 +- .../calcite/testProjectJoinTransposeItem.json | 206 +- tests/calcite/testProjectSetOpTranspose.json | 148 +- .../testPullAggregateThroughUnion.json | 530 +---- .../testPullAggregateThroughUnion2.json | 530 +---- ...llAggregateThroughUnionAndAddProjects.json | 530 +---- ...estPullAggregateThroughUnionWithAlias.json | 642 +----- tests/calcite/testPullConstantIntoFilter.json | 232 +- tests/calcite/testPullConstantIntoJoin.json | 204 +- tests/calcite/testPullConstantIntoJoin2.json | 278 +-- .../calcite/testPullConstantIntoProject.json | 100 +- ...stantIntoProjectWithIsNotDistinctFrom.json | 158 +- ...tIntoProjectWithIsNotDistinctFromDate.json | 69 + ...toProjectWithIsNotDistinctFromForNull.json | 108 +- ...tPullConstantThroughAggregateAllConst.json | 270 +-- ...llConstantThroughAggregateAllLiterals.json | 270 +-- ...lConstantThroughAggregateConstGroupBy.json | 264 +-- ...tPullConstantThroughAggregatePermuted.json | 376 +-- ...antThroughAggregatePermutedConstFirst.json | 226 +- ...tThroughAggregatePermutedConstGroupBy.json | 250 +- ...tantThroughAggregateSimpleNonNullable.json | 226 +- .../testPullConstantThroughConstLast.json | 226 +- .../calcite/testPullConstantThroughUnion.json | 78 +- .../testPullConstantThroughUnion3.json | 90 +- ...tantThroughUnionSameTypeNullableField.json | 186 ++ .../testPullFilterThroughAggregate.json | 284 +-- ...ullFilterThroughAggregateGroupingSets.json | 487 +--- tests/calcite/testPullNull.json | 150 +- ...ushAboveFiltersIntoInnerJoinCondition.json | 136 +- ...testPushAggregateFunctionsThroughJoin.json | 588 ++--- .../calcite/testPushAggregateSumNoGroup.json | 441 +--- .../testPushAggregateSumThroughJoin.json | 584 ++--- ...ateSumThroughJoinAfterAggregateReduce.json | 908 ++------ ...ggregateSumWithoutGroupKeyThroughJoin.json | 784 ++----- .../testPushAggregateThroughJoin1.json | 484 ++-- .../testPushAggregateThroughJoin2.json | 1098 ++------- .../testPushAggregateThroughJoin4.json | 195 +- .../testPushAggregateThroughJoin5.json | 225 +- .../testPushAggregateThroughJoin6.json | 506 +--- .../testPushAggregateThroughJoin7.json | 445 +--- .../testPushAggregateThroughJoin8.json | 445 +--- .../testPushAggregateThroughJoinDistinct.json | 377 +-- ...regateThroughJoinOnEmptyLogicalValues.json | 526 ++--- ...shAggregateThroughJoinWithUniqueInput.json | 904 ++------ .../testPushAggregateThroughOuterJoin1.json | 743 ++---- .../testPushAggregateThroughOuterJoin12.json | 714 ++---- .../testPushAggregateThroughOuterJoin13.json | 714 ++---- .../testPushAggregateThroughOuterJoin14.json | 460 +--- .../testPushAggregateThroughOuterJoin15.json | 794 ++----- .../testPushAggregateThroughOuterJoin16.json | 1066 ++------- .../testPushAggregateThroughOuterJoin2.json | 733 ++---- .../testPushAggregateThroughOuterJoin3.json | 794 ++----- .../testPushAggregateThroughOuterJoin4.json | 480 ++-- .../testPushAggregateThroughOuterJoin5.json | 714 ++---- .../testPushAggregateThroughOuterJoin6.json | 484 ++-- .../testPushAggregateThroughOuterJoin7.json | 1066 ++------- .../testPushAggregateThroughOuterJoin8.json | 1066 ++------- .../testPushAggregateThroughOuterJoin9.json | 1098 ++------- .../testPushAvgGroupingSetsThroughUnion.json | 466 ++-- tests/calcite/testPushAvgThroughUnion.json | 419 ++-- .../testPushBoolAndBoolOrThroughUnion.json | 846 ++----- .../testPushCountFilterThroughUnion.json | 1005 ++------ ...CountNullableGroupingSetsThroughUnion.json | 812 ++----- .../testPushCountNullableThroughUnion.json | 691 ++---- ...PushCountStarGroupingSetsThroughUnion.json | 751 ++---- .../testPushCountStarThroughUnion.json | 632 ++--- tests/calcite/testPushFilterPastAgg.json | 242 +- tests/calcite/testPushFilterPastAggFour.json | 500 +--- tests/calcite/testPushFilterPastAggTwo.json | 340 +-- ...estPushFilterPastAggWithGroupingSets2.json | 294 +-- tests/calcite/testPushFilterPastProject.json | 272 +-- tests/calcite/testPushFilterSemijoin.json | 76 +- .../testPushFilterThroughSemiJoin.json | 94 +- ...shFilterWithIsNotDistinctFromPastJoin.json | 180 +- .../testPushJoinCondDownToProject.json | 184 +- .../testPushJoinThroughUnionOnLeft.json | 84 +- .../testPushJoinThroughUnionOnRight.json | 84 +- ...shMaxNullableGroupingSetsThroughUnion.json | 810 ++----- .../testPushMaxNullableThroughUnion.json | 691 ++---- .../testPushMinGroupingSetsThroughUnion.json | 810 ++----- tests/calcite/testPushMinThroughUnion.json | 691 ++---- tests/calcite/testPushProjectPastFilter.json | 118 +- tests/calcite/testPushProjectPastFilter2.json | 266 +-- .../calcite/testPushProjectPastFilter3b.json | 174 +- .../calcite/testPushProjectPastFilter3c.json | 174 +- .../calcite/testPushProjectPastFullJoin.json | 502 ++-- .../testPushProjectPastFullJoinStrong.json | 477 ++-- .../calcite/testPushProjectPastInnerJoin.json | 483 ++-- .../testPushProjectPastInnerJoinStrong.json | 477 ++-- tests/calcite/testPushProjectPastJoin.json | 118 +- .../calcite/testPushProjectPastLeftJoin.json | 483 ++-- .../testPushProjectPastLeftJoinSwap.json | 500 ++-- ...testPushProjectPastLeftJoinSwapStrong.json | 475 ++-- ...ProjectPastOutJoinWithCastNonNullExpr.json | 263 +++ .../calcite/testPushProjectPastRightJoin.json | 502 ++-- .../testPushProjectPastRightJoinStrong.json | 477 ++-- .../testPushProjectPastRightJoinSwap.json | 481 ++-- ...estPushProjectPastRightJoinSwapStrong.json | 475 ++-- tests/calcite/testPushProjectPastSetOp.json | 76 +- ...hProjectWithIsNotDistinctFromPastJoin.json | 196 +- .../testPushProjectWithOverPastJoin1.json | 134 +- .../testPushProjectWithOverPastJoin2.json | 134 +- .../testPushProjectWithOverPastJoin3.json | 161 +- tests/calcite/testPushSemiJoinConditions.json | 144 +- tests/calcite/testPushSemiJoinPastFilter.json | 86 +- .../testPushSemiJoinPastJoinRuleLeft.json | 92 +- ...RuleNotHappensJoinKeysDifferentOrigin.json | 215 ++ .../testPushSemiJoinPastJoinRuleRight.json | 92 +- .../calcite/testPushSemiJoinPastProject.json | 172 +- ...shSumConstantGroupingSetsThroughUnion.json | 844 ++----- .../testPushSumConstantThroughUnion.json | 725 ++---- ...hSumCountStarGroupingSetsThroughUnion.json | 1054 +++------ .../testPushSumCountStarThroughUnion.json | 968 +++----- ...mNullConstantGroupingSetsThroughUnion.json | 844 ++----- .../testPushSumNullConstantThroughUnion.json | 725 ++---- ...shSumNullableGroupingSetsThroughUnion.json | 810 ++----- .../testPushSumNullableNOGBYThroughUnion.json | 568 ++--- .../testPushSumNullableThroughUnion.json | 691 ++---- .../testReduceAggregateFunctionsByGroup.json | 320 +-- .../testReduceAllAggregateFunctions.json | 481 ++-- tests/calcite/testReduceAverage.json | 244 +- ...AverageAndSumWithNoReduceStddevAndVar.json | 268 +-- ...ReduceAverageAndVarWithNoReduceStddev.json | 337 +-- .../testReduceAverageWithNoReduceSum.json | 244 +- tests/calcite/testReduceCase.json | 50 +- .../testReduceCaseNullabilityChange.json | 86 +- tests/calcite/testReduceCastAndConsts.json | 126 +- tests/calcite/testReduceCasts.json | 280 +-- .../testReduceCompositeInSubQuery.json | 346 +-- tests/calcite/testReduceConstants.json | 414 ++-- tests/calcite/testReduceConstants3.json | 128 +- .../testReduceConstantsCaseEquals.json | 309 +-- .../testReduceConstantsCaseEquals2.json | 309 +-- .../testReduceConstantsCaseEquals3.json | 395 +--- tests/calcite/testReduceConstantsDup.json | 54 +- tests/calcite/testReduceConstantsDup2.json | 130 +- tests/calcite/testReduceConstantsDup3.json | 52 +- .../calcite/testReduceConstantsDup3Null.json | 58 +- tests/calcite/testReduceConstantsDupNot.json | 56 +- tests/calcite/testReduceConstantsDupNot2.json | 64 +- .../testReduceConstantsDupNot2Null.json | 82 +- .../testReduceConstantsDupNotNull.json | 62 +- .../testReduceConstantsEliminatesFilter.json | 66 +- .../calcite/testReduceConstantsIsNotNull.json | 58 +- tests/calcite/testReduceConstantsIsNull.json | 50 +- tests/calcite/testReduceConstantsNegated.json | 58 +- .../testReduceConstantsNegatedInverted.json | 54 +- tests/calcite/testReduceConstantsNull.json | 94 +- .../testReduceConstantsNullEqualsOne.json | 186 +- .../testReduceConstantsProjectNullable.json | 60 +- .../testReduceConstantsRequiresExecutor.json | 66 +- tests/calcite/testReduceDynamic.json | 38 +- tests/calcite/testReduceNestedCaseWhen.json | 106 +- .../calcite/testReduceNullableToNotNull.json | 66 +- .../calcite/testReduceNullableToNotNull2.json | 66 +- tests/calcite/testReduceOrCaseWhen.json | 94 +- tests/calcite/testReduceValuesToEmpty.json | 68 +- .../calcite/testReduceValuesUnderFilter.json | 62 +- .../calcite/testReduceValuesUnderProject.json | 52 +- .../testReduceValuesUnderProjectFilter.json | 100 +- .../testReduceWithNonTypePredicate.json | 260 +-- tests/calcite/testRemoveDistinctOnAgg.json | 247 +- tests/calcite/testRemoveSemiJoin.json | 60 +- tests/calcite/testRemoveSemiJoinRight.json | 80 +- .../testRemoveSemiJoinRightWithFilter.json | 96 +- .../calcite/testRemoveSemiJoinWithFilter.json | 80 +- tests/calcite/testRightEmptyAntiJoin.json | 38 +- .../testRightEmptyAntiJoinNonEqui.json | 50 +- tests/calcite/testRightEmptyFullJoin.json | 206 +- tests/calcite/testRightEmptyInnerJoin.json | 124 +- tests/calcite/testRightEmptyLeftJoin.json | 178 +- tests/calcite/testRightEmptyRightJoin.json | 124 +- tests/calcite/testRightEmptySemiJoin.json | 40 +- ...stRightOuterJoinSimplificationToInner.json | 148 +- tests/calcite/testSelectAnyCorrelated.json | 323 +++ tests/calcite/testSelectNotInCorrelated.json | 131 ++ .../testSemiCorrelateWithLeftEmpty.json | 45 + .../testSemiCorrelateWithRightEmpty.json | 30 + .../calcite/testSemiJoinProjectTranspose.json | 247 +- .../calcite/testSemiJoinReduceConstants.json | 134 +- tests/calcite/testSemiJoinRule.json | 167 +- tests/calcite/testSemiJoinRuleExists.json | 167 +- tests/calcite/testSemiJoinRuleLeft.json | 145 +- tests/calcite/testSemiJoinRuleWithHint.json | 127 +- ...testSemiJoinRuleWithJoinOnUniqueInput.json | 100 +- ...oinRuleWithJoinOnUniqueInputWithAlias.json | 121 + tests/calcite/testSemiJoinTrim.json | 146 +- tests/calcite/testSimplifyFilter.json | 240 +- .../testSkipReduceConstantsCaseEquals.json | 214 +- tests/calcite/testSome.json | 357 ++- tests/calcite/testSomeWithEquality.json | 180 +- tests/calcite/testSomeWithEquality2.json | 235 +- tests/calcite/testSomeWithNotEquality.json | 393 ++-- .../testSomeWithTwoCorrelatedSubQueries.json | 543 +++++ tests/calcite/testSomeWithTwoSubQueries.json | 414 ++++ .../testSortJoinCopyInnerJoinOrderBy.json | 118 +- ...testSortJoinCopyInnerJoinOrderByLimit.json | 156 +- ...SortJoinCopyInnerJoinOrderByTwoFields.json | 132 +- .../testSortJoinCopySemiJoinOrderBy.json | 70 +- ...ortJoinCopySemiJoinOrderByLimitOffset.json | 82 +- ...testSortJoinCopySemiJoinOrderByOffset.json | 76 +- tests/calcite/testSortJoinTranspose1.json | 159 +- tests/calcite/testSortJoinTranspose2.json | 150 +- tests/calcite/testSortJoinTranspose4.json | 150 +- tests/calcite/testSortJoinTranspose6.json | 98 +- tests/calcite/testSortProjectTranspose1.json | 94 +- tests/calcite/testSortProjectTranspose2.json | 106 +- .../testSortRemovalAllKeysConstant.json | 276 +-- .../testSortRemovalOneKeyConstant.json | 298 +-- tests/calcite/testSortUnionTranspose.json | 92 +- tests/calcite/testSortUnionTranspose2.json | 80 +- tests/calcite/testSortUnionTranspose3.json | 92 +- tests/calcite/testSpatialContainsPoint.json | 110 +- tests/calcite/testSpatialDWithinLine.json | 126 +- tests/calcite/testSpatialDWithinReversed.json | 110 +- .../calcite/testSpatialDWithinToHilbert.json | 110 +- .../testSpatialDWithinToHilbertNegative.json | 82 +- .../testSpatialDWithinToHilbertZero.json | 106 +- tests/calcite/testSpatialReduce.json | 62 +- tests/calcite/testStrengthenJoinType.json | 236 +- ...estSumAndDistinctSumWithExpandSumType.json | 296 +-- tests/calcite/testSwapOuterJoin.json | 100 +- .../testTransitiveInferenceAggregate.json | 276 +-- ...stTransitiveInferenceComplexPredicate.json | 130 +- ...stTransitiveInferenceConjunctInPullUp.json | 74 +- .../calcite/testTransitiveInferenceJoin.json | 74 +- .../testTransitiveInferenceJoin3way.json | 94 +- .../testTransitiveInferenceJoin3wayAgg.json | 296 +-- .../testTransitiveInferenceLeftOuterJoin.json | 90 +- .../testTransitiveInferenceProject.json | 138 +- ...estTransitiveInferencePullUpThruAlias.json | 94 +- ...testTransitiveInferenceRightOuterJoin.json | 90 +- .../calcite/testTransitiveInferenceUnion.json | 130 +- .../testTransitiveInferenceUnion3way.json | 166 +- ...estTransitiveInferenceUnionAlwaysTrue.json | 148 +- ...IsFlattenedOnlyIfSiblingOfCorrelation.json | 665 ++---- tests/calcite/testUnionMergeRule.json | 544 ++--- tests/calcite/testUnionToDistinctRule.json | 163 +- .../testWhereAnyCorrelatedInSelect.json | 464 ++-- .../testWhereExpressionInCorrelated.json | 224 +- .../testWhereExpressionInCorrelated2.json | 240 +- tests/calcite/testWhereInCorrelated.json | 102 +- tests/calcite/testWhereInJoinCorrelated.json | 280 +-- tests/calcite/testWhereNotInCorrelated.json | 235 +- tests/calcite/testWhereNotInCorrelated2.json | 383 ++- tests/calcite/testWhereOrSubQuery.json | 228 +- tests/calcite/testWithinDistinct.json | 674 ++---- .../testWithinDistinctCountDistinct.json | 844 ++----- .../testWithinDistinctFilteredAggs.json | 1532 ++++-------- ...tWithinDistinctFilteredAggsSameFilter.json | 1430 ++++-------- ...stinctFilteredAggsUniformDistinctKeys.json | 1250 +++------- ...ilteredAggsUniformDistinctKeysNoThrow.json | 876 ++----- tests/calcite/testWithinDistinctNoThrow.json | 556 ++--- ...testWithinDistinctUniformDistinctKeys.json | 662 ++---- ...hinDistinctUniformDistinctKeysNoThrow.json | 450 +--- 451 files changed, 46846 insertions(+), 90167 deletions(-) create mode 100644 tests/calcite/testAntiCorrelateWithLeftEmpty.json create mode 100644 tests/calcite/testAntiCorrelateWithRightEmpty.json create mode 100644 tests/calcite/testCorrelateWithoutCorrelationToEmpty.json create mode 100644 tests/calcite/testEmptyTable.json create mode 100644 tests/calcite/testEmptyTableTransformsComplexQueryToSingleTableScan.json create mode 100644 tests/calcite/testExpandFilterConstantInCorrelatedWithTwoSubQueries.json create mode 100644 tests/calcite/testExpandFilterConstantInWithTwoSubQueries.json create mode 100644 tests/calcite/testExpandFilterInCorrelatedWithTwoSubQueries.json create mode 100644 tests/calcite/testExpandFilterInWithTwoSubQueries.json create mode 100644 tests/calcite/testExpandProjectInWithTwoSubQueries.json create mode 100644 tests/calcite/testInnerCorrelateWithLeftEmpty.json create mode 100644 tests/calcite/testInnerCorrelateWithRightEmpty.json create mode 100644 tests/calcite/testJoinDeriveIsNotNullFilterRule15.json create mode 100644 tests/calcite/testLeftCorrelateWithBothEmpty1.json create mode 100644 tests/calcite/testLeftCorrelateWithBothEmpty2.json create mode 100644 tests/calcite/testLeftCorrelateWithBothEmpty3.json create mode 100644 tests/calcite/testLeftCorrelateWithLeftEmpty.json create mode 100644 tests/calcite/testLeftCorrelateWithRightEmpty.json delete mode 100644 tests/calcite/testMinusMergeRule.json create mode 100644 tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFromDate.json create mode 100644 tests/calcite/testPullConstantThroughUnionSameTypeNullableField.json create mode 100644 tests/calcite/testPushProjectPastOutJoinWithCastNonNullExpr.json create mode 100644 tests/calcite/testPushSemiJoinPastJoinRuleNotHappensJoinKeysDifferentOrigin.json create mode 100644 tests/calcite/testSelectAnyCorrelated.json create mode 100644 tests/calcite/testSelectNotInCorrelated.json create mode 100644 tests/calcite/testSemiCorrelateWithLeftEmpty.json create mode 100644 tests/calcite/testSemiCorrelateWithRightEmpty.json create mode 100644 tests/calcite/testSemiJoinRuleWithJoinOnUniqueInputWithAlias.json create mode 100644 tests/calcite/testSomeWithTwoCorrelatedSubQueries.json create mode 100644 tests/calcite/testSomeWithTwoSubQueries.json diff --git a/Cargo.lock b/Cargo.lock index 0ed29c8..4e4d95c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "aho-corasick" -version = "1.0.4" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -57,9 +57,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "bitmaps" @@ -67,15 +67,6 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "703642b98a00b3b90513279a8ede3fcfa479c126c5fb46e78f3051522f021403" -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] - [[package]] name = "cexpr" version = "0.6.0" @@ -128,8 +119,7 @@ dependencies = [ [[package]] name = "crossbeam" version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c" +source = "git+https://github.com/crossbeam-rs/crossbeam?branch=master#5fd21b032388c2e418c7306ba6149e1881943c31" dependencies = [ "cfg-if", "crossbeam-channel", @@ -142,8 +132,7 @@ dependencies = [ [[package]] name = "crossbeam-channel" version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +source = "git+https://github.com/crossbeam-rs/crossbeam?branch=master#5fd21b032388c2e418c7306ba6149e1881943c31" dependencies = [ "cfg-if", "crossbeam-utils", @@ -152,8 +141,7 @@ dependencies = [ [[package]] name = "crossbeam-deque" version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +source = "git+https://github.com/crossbeam-rs/crossbeam?branch=master#5fd21b032388c2e418c7306ba6149e1881943c31" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -163,8 +151,7 @@ dependencies = [ [[package]] name = "crossbeam-epoch" version = "0.9.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +source = "git+https://github.com/crossbeam-rs/crossbeam?branch=master#5fd21b032388c2e418c7306ba6149e1881943c31" dependencies = [ "autocfg", "cfg-if", @@ -176,8 +163,7 @@ dependencies = [ [[package]] name = "crossbeam-queue" version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +source = "git+https://github.com/crossbeam-rs/crossbeam?branch=master#5fd21b032388c2e418c7306ba6149e1881943c31" dependencies = [ "cfg-if", "crossbeam-utils", @@ -186,8 +172,7 @@ dependencies = [ [[package]] name = "crossbeam-utils" version = "0.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +source = "git+https://github.com/crossbeam-rs/crossbeam?branch=master#5fd21b032388c2e418c7306ba6149e1881943c31" dependencies = [ "cfg-if", ] @@ -247,25 +232,14 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" dependencies = [ - "errno-dragonfly", "libc", "windows-sys", ] -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "fnv" version = "1.0.7" @@ -280,9 +254,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "humantime" @@ -298,9 +272,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "imbl" -version = "2.0.2" +version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b4555023847ca2cd6fd11f20b553886e6981c7e8aee9b3e7e960b4b17fb440" +checksum = "978d142c8028edf52095703af2fad11d6f611af1246685725d6b850634647085" dependencies = [ "bitmaps", "imbl-sized-chunks", @@ -373,9 +347,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libloading" @@ -389,9 +363,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "log" @@ -401,9 +375,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.6.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76fc44e2588d5b436dbc3c6cf62aef290f90dab6235744a93dfe1cc18f451e2c" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "memoffset" @@ -499,9 +473,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] @@ -526,9 +500,9 @@ checksum = "d9978962f8a4b158e97447a6d09d2d75e206d2994eff056c894019f362b27142" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -559,9 +533,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.4" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", @@ -571,9 +545,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.7" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", @@ -582,9 +556,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.5" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "rustc-hash" @@ -594,11 +568,11 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" -version = "0.38.10" +version = "0.38.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6248e1caa625eb708e266e06159f135e8c26f2bb7ceb72dc4b2766d0340964" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", @@ -628,9 +602,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" dependencies = [ "serde_derive", ] @@ -667,20 +641,20 @@ checksum = "794e44574226fc701e3be5c651feb7939038fc67fb73f6f4dd5c4ba90fd3be70" [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -689,9 +663,9 @@ dependencies = [ [[package]] name = "shlex" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" +checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" [[package]] name = "syn" @@ -706,9 +680,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.29" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -717,18 +691,18 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" dependencies = [ "winapi-util", ] [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "version_check" @@ -738,9 +712,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", @@ -764,9 +738,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] diff --git a/Cargo.toml b/Cargo.toml index 8339f12..8a4203e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,5 +22,5 @@ env_logger = "0.10" imbl = "2.0" anyhow = "1.0" num = "0.4" -crossbeam = "0.8" +crossbeam = { git = "https://github.com/crossbeam-rs/crossbeam", branch = "master" } isoperm = { git = "https://github.com/Sicheng-Pan/isoperm", branch = "master" } diff --git a/flake.lock b/flake.lock index 583c1d9..f794a4d 100644 --- a/flake.lock +++ b/flake.lock @@ -2,21 +2,16 @@ "nodes": { "crane": { "inputs": { - "flake-compat": "flake-compat", - "flake-utils": [ - "flake-utils" - ], "nixpkgs": [ "nixpkgs" - ], - "rust-overlay": "rust-overlay" + ] }, "locked": { - "lastModified": 1688772518, - "narHash": "sha256-ol7gZxwvgLnxNSZwFTDJJ49xVY5teaSvF7lzlo3YQfM=", + "lastModified": 1698166613, + "narHash": "sha256-y4rdN4flxRiROqNi1waMYIZj/Fs7L2OrszFk/1ry9vU=", "owner": "ipetkov", "repo": "crane", - "rev": "8b08e96c9af8c6e3a2b69af5a7fa168750fcf88e", + "rev": "b7db46f0f1751f7b1d1911f6be7daf568ad5bc65", "type": "github" }, "original": { @@ -33,11 +28,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1689143068, - "narHash": "sha256-e4sFP90ZPkBd+ADnCb0Mohc1oAuUQ4DbJytMyY50GoM=", + "lastModified": 1698646935, + "narHash": "sha256-FgHpELKq1AxZRkL3BzLgfCBMJ4kxAjHCuPwj/uh83d0=", "owner": "nix-community", "repo": "fenix", - "rev": "44afdb4711d40da215349d2bdf6dabb1e445d50d", + "rev": "53f0f31a978f1e056763d6d465b0f44af2454a7b", "type": "github" }, "original": { @@ -46,32 +41,16 @@ "type": "github" } }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-utils": { "inputs": { "systems": "systems" }, "locked": { - "lastModified": 1689068808, - "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", "owner": "numtide", "repo": "flake-utils", - "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", "type": "github" }, "original": { @@ -82,11 +61,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1689078114, - "narHash": "sha256-osG8BrX5RpKJ7wH+vI6auOU+ctvNOblT4XXCgknK47c=", + "lastModified": 1698553279, + "narHash": "sha256-T/9P8yBSLcqo/v+FTOBK+0rjzjPMctVymZydbvR/Fak=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b6cc7ff8fee93789bc871a267ab876c3fca042cb", + "rev": "90e85bc7c1a6fc0760a94ace129d3a1c61c3d035", "type": "github" }, "original": { @@ -101,17 +80,18 @@ "crane": "crane", "fenix": "fenix", "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "z3": "z3" } }, "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1689076917, - "narHash": "sha256-qVWiZWmnEh5SLaMGC9SrKje3A0imueA5esCrqLJi1WY=", + "lastModified": 1698474035, + "narHash": "sha256-IaufRsz2ATI7vSnnqQxMlcREPFpBDyQqqPFvKp+FjMA=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "75ac37f317269798da87d42738d79cade3a28ab9", + "rev": "f493207744da98b31295b02e6ed95b26a927056c", "type": "github" }, "original": { @@ -121,31 +101,6 @@ "type": "github" } }, - "rust-overlay": { - "inputs": { - "flake-utils": [ - "crane", - "flake-utils" - ], - "nixpkgs": [ - "crane", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1688351637, - "narHash": "sha256-CLTufJ29VxNOIZ8UTg0lepsn3X03AmopmaLTTeHDCL4=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "f9b92316727af9e6c7fee4a761242f7f46880329", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, "systems": { "locked": { "lastModified": 1681028828, @@ -160,6 +115,22 @@ "repo": "default", "type": "github" } + }, + "z3": { + "flake": false, + "locked": { + "lastModified": 1700100528, + "narHash": "sha256-+WcLC+byeKlnBfHXC6/JpAKEddFcG2k6Sck3m/Md76w=", + "owner": "Z3Prover", + "repo": "z3", + "rev": "5b9fdcf46234ea241156c8450ba2c49674918444", + "type": "github" + }, + "original": { + "owner": "Z3Prover", + "repo": "z3", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index b9c35f5..a4fac89 100644 --- a/flake.nix +++ b/flake.nix @@ -4,23 +4,25 @@ flake-utils.url = "github:numtide/flake-utils"; crane = { url = "github:ipetkov/crane"; - inputs = { - nixpkgs.follows = "nixpkgs"; - flake-utils.follows = "flake-utils"; - }; + inputs.nixpkgs.follows = "nixpkgs"; }; fenix = { url = "github:nix-community/fenix"; inputs.nixpkgs.follows = "nixpkgs"; }; + z3 = { + url = "github:Z3Prover/z3"; + flake = false; + }; }; - outputs = { self, nixpkgs, flake-utils, crane, fenix }: + outputs = { self, nixpkgs, flake-utils, crane, fenix, z3 }: flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; # Switch to nightly toolchain craneLib = crane.lib.${system}.overrideToolchain fenix.packages.${system}.complete.toolchain; + z3_4_12 = pkgs.z3_4_12.overrideAttrs (prev: { src = z3; }); packageDef = with pkgs; { src = craneLib.cleanCargoSource ./.; buildInputs = with pkgs; [ z3_4_12 cvc5 ]; @@ -31,7 +33,7 @@ cosette-prover = craneLib.buildPackage (packageDef // { inherit cargoArtifacts; doNotLinkInheritedArtifacts = true; - postInstall = with pkgs; "wrapProgram $out/bin/cosette-prover --set PATH ${lib.makeBinPath [ cvc5 z3_4_11 ]}"; + postInstall = with pkgs; "wrapProgram $out/bin/cosette-prover --set PATH ${lib.makeBinPath [ cvc5 z3_4_12 ]}"; }); in { packages.default = cosette-prover; diff --git a/src/pipeline/normal.rs b/src/pipeline/normal.rs index 9913dce..4deb59d 100644 --- a/src/pipeline/normal.rs +++ b/src/pipeline/normal.rs @@ -177,7 +177,7 @@ impl Term { } fn exprs(&self) -> Vector<&Expr> { - let Sigma(scope, Inner { logic, apps }) = self; + let Sigma(_, Inner { logic, apps }) = self; logic.exprs() + apps.iter().flat_map(Neutral::exprs).collect() } } @@ -654,6 +654,13 @@ impl<'c> Eval<&Expr, Dynamic<'c>> for &Z3Env<'c> { ctx.bool_is_true(cond).ite(body, &rem) }) }, + "CASE" if args.len() >= 2 && args.len() % 2 == 0 => { + let input = args[0].clone(); + let (chunks, remainder) = args[1..].as_chunks(); + chunks.iter().rfold(remainder[0].clone(), |rem, [val, body]| { + input._eq(val).ite(body, &rem) + }) + }, "CAST" if ty == &expr_args[0].ty() => args[0].clone(), "CAST" if ty == &Real && expr_args[0].ty() == Integer => { ctx.int_to_real(args[0]) @@ -667,7 +674,7 @@ impl<'c> Eval<&Expr, Dynamic<'c>> for &Z3Env<'c> { ctx.app(&format!("f{}!{}", args.len(), op), &args, ty, true) } }, - op => ctx.app(&format!("f!{}", op), &args, ty, true), + op => ctx.app(&format!("f!{}", op.replace("'", "\"")), &args, ty, true), } }, Expr::HOp(f, args, rel, DataType::Boolean) if f == "IN" => { diff --git a/src/pipeline/relation.rs b/src/pipeline/relation.rs index 48f8047..a68086d 100644 --- a/src/pipeline/relation.rs +++ b/src/pipeline/relation.rs @@ -37,7 +37,12 @@ pub enum Relation { right: Box, kind: JoinKind, }, - Correlate(Box, Box), + Correlate { + // TODO: Add condition? + left: Box, + right: Box, + kind: JoinKind, + }, Union(Vec), Intersect(Vec), Except(Box, Box), @@ -51,6 +56,12 @@ pub enum Relation { columns: Vec, source: Box, }, + Group { + keys: Vec, + #[serde(alias = "function")] + columns: Vec, + source: Box, + }, Sort { collation: Vec<(usize, DataType, String)>, offset: Option, @@ -61,6 +72,7 @@ pub enum Relation { impl Relation { fn scope(&self, schemas: &[Schema]) -> Vector { + use JoinKind::*; use Relation::*; match self { Singleton => Vector::new(), @@ -68,8 +80,15 @@ impl Relation { Filter { source, .. } => source.scope(schemas), Project { columns, .. } => columns.iter().map(|expr| expr.ty()).collect(), Aggregate { columns, .. } => columns.iter().map(|agg| agg.ty.clone()).collect(), - Join { left, kind: JoinKind::Semi | JoinKind::Anti, .. } => left.scope(schemas), - Join { left, right, .. } | Correlate(left, right) => { + Group { columns, keys: key, .. } => key + .iter() + .map(|expr| expr.ty()) + .chain(columns.iter().map(|agg| agg.ty.clone())) + .collect(), + Join { left, kind: Semi | Anti, .. } | Correlate { left, kind: Semi | Anti, .. } => { + left.scope(schemas) + }, + Join { left, right, .. } | Correlate { left, right, .. } => { left.scope(schemas) + right.scope(schemas) }, Union(rels) | Intersect(rels) => rels[0].scope(schemas), @@ -84,6 +103,7 @@ impl Relation { impl Eval for Env<'_> { fn eval(self, source: Relation) -> syntax::Relation { use syntax::UExpr::*; + use JoinKind::*; use Relation::*; let Env(schemas, subst, lvl) = self; let scope = source.scope(schemas); @@ -143,23 +163,23 @@ impl Eval for Env<'_> { // Project f[x, y] from R(x, y) // λ a. ∑ x, y. [a = f[x, y]] × R(x, y) Project { columns, source } => { - let proj_vars = vars(lvl, scope.clone()); let inner_scope = source.scope(schemas); let inner_vars = vars(lvl + scope.len(), inner_scope.clone()); let inner_lvl = lvl + scope.len() + inner_scope.len(); let source = Env(schemas, subst, inner_lvl).eval(*source); let cols_subst = subst + &inner_vars; - let cols_env = Env(schemas, &(cols_subst), inner_lvl); - let body = proj_vars + let cols_env = Env(schemas, &cols_subst, inner_lvl); + let matches = vars(lvl, scope.clone()) .into_iter() .zip(columns) - .map(|(var, col)| UExpr::pred(Logic::Eq(var, cols_env.eval(col)))) - .fold(UExpr::app(source, inner_vars), UExpr::mul); - Lambda(scope, UExpr::sum(inner_scope, body)) + .map(|(var, col)| Logic::Eq(var, cols_env.eval(col))) + .collect(); + let app = UExpr::app(source, inner_vars); + Lambda(scope, UExpr::sum(inner_scope, UExpr::pred(Logic::And(matches)) * app)) }, // R(x) semi join S(y) on P[x, y] // λ x. R(x) × ‖∑ y. [P[x, y]] × S(y)‖ - Join { condition, left, right, kind: kind @ (JoinKind::Semi | JoinKind::Anti) } => { + Join { condition, left, right, kind: kind @ (Semi | Anti) } => { let left_vars = vars(lvl, scope.clone()); let body_lvl = lvl + scope.len(); let inner_scope = right.scope(schemas); @@ -171,8 +191,8 @@ impl Eval for Env<'_> { UExpr::app(Env(schemas, subst, inner_lvl).eval(*right), right_vars); let left_body = UExpr::app(Env(schemas, subst, body_lvl).eval(*left), left_vars); let wrapper = match kind { - JoinKind::Semi => UExpr::squash, - JoinKind::Anti => UExpr::not, + Semi => UExpr::squash, + Anti => UExpr::not, _ => unreachable!(), }; Lambda(scope, left_body * wrapper(UExpr::sum(inner_scope, cond * right_body))) @@ -216,25 +236,54 @@ impl Eval for Env<'_> { .fold(other_body * !UExpr::sum(inner_scope, inner_body), UExpr::mul) }; match kind { - JoinKind::Inner => Lambda(scope, matching), - JoinKind::Left => Lambda(scope, matching + miss(false)), - JoinKind::Right => Lambda(scope, matching + miss(true)), - JoinKind::Full => Lambda(scope, matching + miss(true) + miss(false)), + Inner => Lambda(scope, matching), + Left => Lambda(scope, matching + miss(false)), + Right => Lambda(scope, matching + miss(true)), + Full => Lambda(scope, matching + miss(true) + miss(false)), _ => unreachable!(), } }, // R(x) correlated join S[x](y) // λx, y. R(x) × S[x](y) - Correlate(left, right) => { + // R(x) left correlated join S[x](y) + // λx, y. R(x) × S[x](y) + R(x) × Null(y) × ¬(∑ y'. S[x](y')) + // R(x) semi correlated join S[x](y) + // λx. R(x) × ‖∑ y. S[x](y)‖ + Correlate { kind, left, right } => { let left_scope = left.scope(schemas); let right_scope = right.scope(schemas); - let right_vars = vars(lvl + left_scope.len(), right_scope); - let left_vars = vars(lvl, left_scope); - let body_lvl = lvl + scope.len(); - let left = Env(schemas, subst, body_lvl).eval(*left); + let left_vars = vars(lvl, left_scope.clone()); let right_subst = subst + &left_vars; - let right = Env(schemas, &right_subst, body_lvl).eval(*right); - Lambda(scope, UExpr::app(left, left_vars) * UExpr::app(right, right_vars)) + let body_lvl = lvl + scope.len(); + let inner = |positive| { + let inner_app = UExpr::app( + Env(schemas, &right_subst, body_lvl + right_scope.len()) + .eval(*right.clone()), + vars(body_lvl, right_scope.clone()), + ); + let wrapper = if positive { UExpr::squash } else { UExpr::not }; + wrapper(UExpr::sum(right_scope.clone(), inner_app)) + }; + let left_app = UExpr::app(Env(schemas, subst, body_lvl).eval(*left), left_vars); + let right_vars = vars(lvl + left_scope.len(), right_scope.clone()); + let right_app = UExpr::app( + Env(schemas, &right_subst, body_lvl).eval(*right.clone()), + right_vars.clone(), + ); + match kind { + Inner => Lambda(scope, left_app * right_app), + Left => { + let nulls = right_vars.iter().map(|v| v.clone().is_null()).collect(); + Lambda( + scope, + left_app.clone() * right_app + + left_app * UExpr::pred(Logic::And(nulls)) * inner(false), + ) + }, + Semi => Lambda(scope, left_app * inner(true)), + Anti => Lambda(scope, left_app * inner(false)), + _ => panic!("Unsupported join type in correlated join."), + } }, // R(x) union all S(y) // λx. R(x) + S(x) @@ -306,6 +355,66 @@ impl Eval for Env<'_> { .map(|(v, agg)| UExpr::pred(Logic::Eq(v, env.eval((agg, *source.clone()))))); Lambda(scope, Mul(cols.collect())) }, + // Agg(f[x, y]) on R(x, y) group by g[x, y] + // λk, a. ‖∑x, y. [k = g[x, y]] × R(x, y)‖ × [a = Agg(λa'. ∑x, y. [a' = f[x, y]] × [k = g[x, y]] × R(x, y))] + Group { keys: key, columns, source } => { + let source_scope = source.scope(schemas); + let (key_vars, agg_vars) = vars(lvl, scope.clone()).split_at(key.len()); + let grouped = |lvl, vars| { + let key_subst = subst + &vars; + let key_env = Env(schemas, &key_subst, lvl); + let matches = key_vars + .iter() + .zip(key.clone()) + .map(|(v, k)| Logic::Eq(v.clone(), key_env.eval(k))); + let app = UExpr::app(Env(schemas, subst, lvl).eval(source.clone()), vars); + UExpr::pred(Logic::And(matches.collect())) * app + }; + let body_lvl = lvl + scope.len(); + let source_vars = vars(body_lvl, source_scope.clone()); + let agged = |agg: AggCall| { + let inner_scope: Vector<_> = agg.args.iter().map(|e| e.ty()).collect(); + let inner_lvl = body_lvl + inner_scope.len(); + let source_vars = vars(inner_lvl, source_scope.clone()); + let arg_subst = subst + &source_vars; + let arg_env = Env(schemas, &arg_subst, inner_lvl + source_scope.len()); + let inner_vars = vars(body_lvl, inner_scope.clone()); + let matches = inner_vars + .iter() + .zip(agg.args) + .map(|(v, arg)| Logic::Eq(v.clone(), arg_env.eval(arg))); + let body = UExpr::sum( + source_scope.clone(), + UExpr::pred(Logic::And(matches.collect())) + * grouped(inner_lvl + source_scope.len(), source_vars), + ); + let body = if agg.ignore_nulls { + let condition = inner_vars.iter().map(|v| !v.clone().is_null()); + UExpr::pred(Logic::And(condition.collect())) * body + } else { + body + }; + let body = if agg.distinct { UExpr::squash(body) } else { body }; + use shared::Expr::{Agg, HOp}; + match agg.op.as_str() { + "COUNT" => Agg(Aggr(agg.op, inner_scope, body, Box::new(1u32.into()))), + _ if inner_scope.len() == 1 => { + Agg(Aggr(agg.op, inner_scope, body, inner_vars[0].clone().into())) + }, + _ => HOp(agg.op, vec![], Lambda(inner_scope, body).into(), agg.ty), + } + }; + let aggs = agg_vars + .into_iter() + .zip(columns) + .map(|(v, agg)| Logic::Eq(v, agged(agg))) + .collect(); + let left = UExpr::squash(UExpr::sum( + source_scope.clone(), + grouped(body_lvl + source_scope.len(), source_vars), + )); + Lambda(scope, left * UExpr::pred(Logic::And(aggs))) + }, Sort { mut collation, offset, limit, source } => { // TODO: Better way to handle multiple sort columns. let vars = vars(lvl, scope.clone()); @@ -364,32 +473,20 @@ fn default_ignore_nulls() -> bool { impl Eval<(AggCall, Relation), syntax::Expr> for Env<'_> { fn eval(self, (agg, rel): (AggCall, Relation)) -> syntax::Expr { - let tys = agg.args.iter().map(|arg| arg.ty()).collect_vec(); let args = agg.args; let source = match agg.op.as_str() { "COUNT" if args.is_empty() => rel, _ => Relation::Project { columns: args, source: rel.into() }, }; - let source = if agg.distinct { Relation::Distinct(source.into()) } else { source }; - let source = if agg.ignore_nulls { - let conditions = tys - .into_iter() - .enumerate() - .map(|(i, ty)| Expr::Op { - op: "IS NOT NULL".into(), - args: vec![Expr::Col { column: VL(i), ty }], - ty: DataType::Boolean, - rel: None, - }) - .collect_vec(); - let condition = - Expr::Op { op: "AND".into(), args: conditions, ty: DataType::Boolean, rel: None }; - Relation::Filter { condition, source: source.into() } - } else { - source - }; let Env(_, _, lvl) = self; let Lambda(scope, body) = self.eval(source); + let body = if agg.ignore_nulls { + let condition = vars(lvl, scope.clone()).into_iter().map(|v| !v.is_null()); + UExpr::pred(Logic::And(condition.collect())) * body + } else { + body + }; + let body = if agg.distinct { UExpr::squash(body) } else { body }; // TODO: Handle various agg calls. match agg.op.as_str() { "COUNT" => syntax::Expr::Agg(Aggr(agg.op, scope, body, Box::new(1u32.into()))), @@ -499,6 +596,8 @@ impl Env<'_> { let e: syntax::Expr = self.eval(args[0].clone()); Some(!e.is_null()) }, + "IS TRUE" => Some(Logic::Bool(self.eval(args[0].clone()))), + "IS NOT TRUE" => Some(!Logic::Bool(self.eval(args[0].clone()))), _ => None, } }, diff --git a/tests/calcite/testAddRedundantSemiJoinRule.json b/tests/calcite/testAddRedundantSemiJoinRule.json index 744b2b9..420927f 100644 --- a/tests/calcite/testAddRedundantSemiJoinRule.json +++ b/tests/calcite/testAddRedundantSemiJoinRule.json @@ -1,31 +1,26 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -33,29 +28,29 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -63,13 +58,12 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -77,22 +71,28 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { "scan" : 1 } } }, + "kind" : "INNER", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateCaseToFilter.json b/tests/calcite/testAggregateCaseToFilter.json index fe3aeb4..7bdea61 100644 --- a/tests/calcite/testAggregateCaseToFilter.json +++ b/tests/calcite/testAggregateCaseToFilter.json @@ -1,572 +1,569 @@ { + "help" : [ "LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)], COUNT_DISTINCT_CLERK=[COUNT(DISTINCT $1)], SUM_SAL_D10=[SUM($2)], SUM_SAL_D20=[SUM($3)], COUNT_D30=[SUM($4)], COUNT_D40=[COUNT($5)], COUNT_D45=[SUM($6)], COUNT_D50=[SUM($7)], SUM_NULL_D60=[SUM($8)], SUM_NULL_D70=[SUM($9)], COUNT_D20=[COUNT($10)])\n LogicalProject(SAL=[$5], $f1=[CASE(=($2, 'CLERK'), $7, null:INTEGER)], $f2=[CASE(=($7, 10), $5, null:INTEGER)], $f3=[CASE(=($7, 20), $5, 0)], $f4=[CASE(=($7, 30), 1, 0)], $f5=[CASE(=($7, 40), 'x', null:CHAR(1))], $f6=[CASE(=($7, 45), 1, null:INTEGER)], $f7=[CASE(=($7, 50), 1, null:INTEGER)], $f8=[null:DECIMAL(19, 9)], $f9=[CASE(=($7, 70), null:INTEGER, 1)], $f10=[CASE(=($7, 20), 1, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SUM_SAL=[$0], COUNT_DISTINCT_CLERK=[$1], SUM_SAL_D10=[$2], SUM_SAL_D20=[$3], COUNT_D30=[CAST($4):INTEGER], COUNT_D40=[$5], COUNT_D45=[$6], COUNT_D50=[$7], SUM_NULL_D60=[$8], SUM_NULL_D70=[$9], COUNT_D20=[$10])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)], COUNT_DISTINCT_CLERK=[COUNT(DISTINCT $2) FILTER $3], SUM_SAL_D10=[SUM($4) FILTER $5], SUM_SAL_D20=[SUM($6) FILTER $7], COUNT_D30=[COUNT() FILTER $8], COUNT_D40=[COUNT() FILTER $9], COUNT_D45=[SUM($10) FILTER $11], COUNT_D50=[SUM($12) FILTER $13], SUM_NULL_D60=[SUM($1)], SUM_NULL_D70=[SUM($14) FILTER $15], COUNT_D20=[COUNT() FILTER $16])\n LogicalProject(SAL=[$5], $f8=[null:DECIMAL(19, 9)], DEPTNO=[$7], $f12=[=($2, 'CLERK')], SAL0=[$5], $f14=[=($7, 10)], SAL1=[$5], $f16=[=($7, 20)], $f17=[=($7, 30)], $f18=[=($7, 40)], $f19=[1], $f20=[=($7, 45)], $f21=[1], $f22=[=($7, 50)], $f23=[1], $f24=[<>($7, 70)], $f25=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 5, + "type" : "CHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "DECIMAL", + "operand" : [ { + "column" : 8, + "type" : "DECIMAL" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 10, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" + "scan" : 0 + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'CLERK'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'CLERK'" + } ], + "operator" : "=" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + } ], + "operator" : "CASE" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, "type" : "INTEGER" }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + } ], + "operator" : "CASE" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, "type" : "INTEGER" }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "=" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "CASE" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, "type" : "INTEGER" }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], + "type" : "INTEGER", + "operand" : [ ], + "operator" : "30" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "CASE" + }, { + "type" : "CHAR", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, "type" : "INTEGER" }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "40", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'x'", - "operand" : [ ], - "type" : "CHAR" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "CHAR" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "45", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], + "type" : "INTEGER", + "operand" : [ ], + "operator" : "40" + } ], + "operator" : "=" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'x'" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "NULL" + } ], + "operator" : "CASE" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, "type" : "INTEGER" }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "50", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], + "type" : "INTEGER", + "operand" : [ ], + "operator" : "45" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + } ], + "operator" : "CASE" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, "type" : "INTEGER" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "DECIMAL" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "70", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], + "operator" : "50" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + } ], + "operator" : "CASE" + }, { + "type" : "DECIMAL", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, "type" : "INTEGER" }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], + "type" : "INTEGER", + "operand" : [ ], + "operator" : "70" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "CASE" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" } ], - "source" : { - "scan" : 0 - } - } - } + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + } ], + "operator" : "CASE" + } ] } - }, { - "aggregate" : { + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ ], "function" : [ { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "SUM", + "ignoreNulls" : false }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "SUM", + "type" : "BIGINT", "operand" : [ { "column" : 2, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "COUNT", + "ignoreNulls" : false }, { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 3, + "column" : 4, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 4, + "column" : 6, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "SUM", + "ignoreNulls" : false }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], "operator" : "COUNT", - "operand" : [ { - "column" : 5, - "type" : "CHAR" - } ], + "ignoreNulls" : false + }, { "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false }, { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 6, + "column" : 10, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 7, + "column" : 12, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "DECIMAL", "operand" : [ { - "column" : 8, + "column" : 1, "type" : "DECIMAL" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "DECIMAL" - }, { "operator" : "SUM", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "ignoreNulls" : false }, { - "operator" : "COUNT", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 10, + "column" : 14, "type" : "INTEGER" } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'CLERK'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "40", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'x'", - "operand" : [ ], - "type" : "CHAR" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "CHAR" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "45", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "50", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "DECIMAL" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "70", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "DECIMAL", + "operand" : [ ], + "operator" : "NULL" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'CLERK'" + } ], + "operator" : "=" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "30" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "40" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "45" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "50" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "70" + } ], + "operator" : "<>" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "=" + } ] } } } - } ] - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -580,12 +577,12 @@ "column" : 3, "type" : "INTEGER" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 4, "type" : "BIGINT" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { "column" : 5, "type" : "BIGINT" @@ -604,390 +601,7 @@ }, { "column" : 10, "type" : "BIGINT" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "DECIMAL" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'CLERK'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "40", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "45", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "50", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "<>", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "70", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 12, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 1, - "type" : "DECIMAL" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "DECIMAL" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 14, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "DECIMAL" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'CLERK'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "40", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "45", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "50", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "<>", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "70", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)], COUNT_DISTINCT_CLERK=[COUNT(DISTINCT $1)], SUM_SAL_D10=[SUM($2)], SUM_SAL_D20=[SUM($3)], COUNT_D30=[SUM($4)], COUNT_D40=[COUNT($5)], COUNT_D45=[SUM($6)], COUNT_D50=[SUM($7)], SUM_NULL_D60=[SUM($8)], SUM_NULL_D70=[SUM($9)], COUNT_D20=[COUNT($10)])\n LogicalProject(SAL=[$5], $f1=[CASE(=($2, 'CLERK'), $7, null:INTEGER)], $f2=[CASE(=($7, 10), $5, null:INTEGER)], $f3=[CASE(=($7, 20), $5, 0)], $f4=[CASE(=($7, 30), 1, 0)], $f5=[CASE(=($7, 40), 'x', null:CHAR(1))], $f6=[CASE(=($7, 45), 1, null:INTEGER)], $f7=[CASE(=($7, 50), 1, null:INTEGER)], $f8=[null:DECIMAL(19, 9)], $f9=[CASE(=($7, 70), null:INTEGER, 1)], $f10=[CASE(=($7, 20), 1, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SUM_SAL=[$0], COUNT_DISTINCT_CLERK=[$1], SUM_SAL_D10=[$2], SUM_SAL_D20=[$3], COUNT_D30=[CAST($4):INTEGER], COUNT_D40=[$5], COUNT_D45=[$6], COUNT_D50=[$7], SUM_NULL_D60=[$8], SUM_NULL_D70=[$9], COUNT_D20=[$10])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)], COUNT_DISTINCT_CLERK=[COUNT(DISTINCT $2) FILTER $3], SUM_SAL_D10=[SUM($4) FILTER $5], SUM_SAL_D20=[SUM($6) FILTER $7], COUNT_D30=[COUNT() FILTER $8], COUNT_D40=[COUNT() FILTER $9], COUNT_D45=[SUM($10) FILTER $11], COUNT_D50=[SUM($12) FILTER $13], SUM_NULL_D60=[SUM($1)], SUM_NULL_D70=[SUM($14) FILTER $15], COUNT_D20=[COUNT() FILTER $16])\n LogicalProject(SAL=[$5], $f8=[null:DECIMAL(19, 9)], DEPTNO=[$7], $f12=[=($2, 'CLERK')], SAL0=[$5], $f14=[=($7, 10)], SAL1=[$5], $f16=[=($7, 20)], $f17=[=($7, 30)], $f18=[=($7, 40)], $f19=[1], $f20=[=($7, 45)], $f21=[1], $f22=[=($7, 50)], $f23=[1], $f24=[<>($7, 70)], $f25=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateConstantKeyRule.json b/tests/calcite/testAggregateConstantKeyRule.json index fb2b623..4531632 100644 --- a/tests/calcite/testAggregateConstantKeyRule.json +++ b/tests/calcite/testAggregateConstantKeyRule.json @@ -1,250 +1,131 @@ { + "help" : [ "LogicalProject(C=[$2])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(C=[$2])\n LogicalProject(DEPTNO=[10], SAL=[$0], C=[$1])\n LogicalAggregate(group=[{0}], C=[COUNT()])\n LogicalProject(SAL=[$5])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 2, - "type" : "BIGINT" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" }, { - "column" : 1, + "column" : 5, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "column" : 2, + "type" : "BIGINT" + } ] + } + }, { + "project" : { + "source" : { + "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], "source" : { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ] } } } - } ] - } - } - } - }, { - "project" : { - "target" : [ { - "column" : 2, - "type" : "BIGINT" - } ], - "source" : { - "project" : { + }, "target" : [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "BIGINT" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - } + } ] } - } + }, + "target" : [ { + "column" : 2, + "type" : "BIGINT" + } ] } - } ], - "help" : [ "LogicalProject(C=[$2])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(C=[$2])\n LogicalProject(DEPTNO=[10], SAL=[$0], C=[$1])\n LogicalAggregate(group=[{0}], C=[COUNT()])\n LogicalProject(SAL=[$5])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateConstantKeyRule3.json b/tests/calcite/testAggregateConstantKeyRule3.json index a1a3bad..f354645 100644 --- a/tests/calcite/testAggregateConstantKeyRule3.json +++ b/tests/calcite/testAggregateConstantKeyRule3.json @@ -1,326 +1,185 @@ { + "help" : [ "LogicalProject(JOB=[$1])\n LogicalFilter(condition=[>($2, 3)])\n LogicalAggregate(group=[{0, 1}], agg#0=[COUNT()])\n LogicalProject(MGR=[$3], JOB=[$2])\n LogicalFilter(condition=[AND(IS NULL($3), =($2, 'Clerk'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(JOB=[$1])\n LogicalFilter(condition=[>($2, 3)])\n LogicalProject(MGR=[$0], JOB=['Clerk':VARCHAR(10)], $f2=[$1])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalProject(MGR=[$3])\n LogicalFilter(condition=[AND(IS NULL($3), =($2, 'Clerk'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "BIGINT" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'Clerk'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, + "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 1, + "column" : 2, "type" : "VARCHAR" }, { - "column" : 3, - "type" : "VARCHAR" + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'Clerk'" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'Clerk'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ] } - } ] + } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "BIGINT" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "_ISO-8859-1'Clerk'", - "operand" : [ ], - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "BIGINT" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'Clerk'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 0, + "column" : 3, "type" : "INTEGER" + } ], + "operator" : "IS NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" }, { - "column" : 1, - "type" : "INTEGER" + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'Clerk'" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'Clerk'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'Clerk'" + }, { + "column" : 1, + "type" : "BIGINT" + } ] } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(JOB=[$1])\n LogicalFilter(condition=[>($2, 3)])\n LogicalAggregate(group=[{0, 1}], agg#0=[COUNT()])\n LogicalProject(MGR=[$3], JOB=[$2])\n LogicalFilter(condition=[AND(IS NULL($3), =($2, 'Clerk'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(JOB=[$1])\n LogicalFilter(condition=[>($2, 3)])\n LogicalProject(MGR=[$0], JOB=['Clerk':VARCHAR(10)], $f2=[$1])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalProject(MGR=[$3])\n LogicalFilter(condition=[AND(IS NULL($3), =($2, 'Clerk'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateDynamicFunction.json b/tests/calcite/testAggregateDynamicFunction.json index 8832919..ac297d5 100644 --- a/tests/calcite/testAggregateDynamicFunction.json +++ b/tests/calcite/testAggregateDynamicFunction.json @@ -1,326 +1,185 @@ { + "help" : [ "LogicalProject(HIREDATE=[$1])\n LogicalFilter(condition=[>($2, 3)])\n LogicalAggregate(group=[{0, 1}], agg#0=[COUNT()])\n LogicalProject(MGR=[$3], HIREDATE=[$4])\n LogicalFilter(condition=[AND(IS NULL($3), =($4, CURRENT_TIMESTAMP))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(HIREDATE=[$1])\n LogicalFilter(condition=[>($2, 3)])\n LogicalProject(MGR=[$0], HIREDATE=[CURRENT_TIMESTAMP], $f2=[$1])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalProject(MGR=[$3])\n LogicalFilter(condition=[AND(IS NULL($3), =($4, CURRENT_TIMESTAMP))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "TIMESTAMP" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "BIGINT" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "TIMESTAMP" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "operator" : "CURRENT_TIMESTAMP", - "operand" : [ ], - "type" : "TIMESTAMP" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], + "column" : 1, + "type" : "TIMESTAMP" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, + "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 1, + "column" : 4, "type" : "TIMESTAMP" }, { - "column" : 3, - "type" : "TIMESTAMP" + "type" : "TIMESTAMP", + "operand" : [ ], + "operator" : "CURRENT_TIMESTAMP" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "operator" : "CURRENT_TIMESTAMP", - "operand" : [ ], - "type" : "TIMESTAMP" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + } ] } - } ] + } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "TIMESTAMP" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "BIGINT" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "CURRENT_TIMESTAMP", - "operand" : [ ], - "type" : "TIMESTAMP" - }, { - "column" : 1, - "type" : "BIGINT" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "operator" : "CURRENT_TIMESTAMP", - "operand" : [ ], - "type" : "TIMESTAMP" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 0, + "column" : 3, "type" : "INTEGER" + } ], + "operator" : "IS NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "TIMESTAMP" }, { - "column" : 1, - "type" : "INTEGER" + "type" : "TIMESTAMP", + "operand" : [ ], + "operator" : "CURRENT_TIMESTAMP" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "operator" : "CURRENT_TIMESTAMP", - "operand" : [ ], - "type" : "TIMESTAMP" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "TIMESTAMP", + "operand" : [ ], + "operator" : "CURRENT_TIMESTAMP" + }, { + "column" : 1, + "type" : "BIGINT" + } ] } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "TIMESTAMP" + } ] } - } ], - "help" : [ "LogicalProject(HIREDATE=[$1])\n LogicalFilter(condition=[>($2, 3)])\n LogicalAggregate(group=[{0, 1}], agg#0=[COUNT()])\n LogicalProject(MGR=[$3], HIREDATE=[$4])\n LogicalFilter(condition=[AND(IS NULL($3), =($4, CURRENT_TIMESTAMP))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(HIREDATE=[$1])\n LogicalFilter(condition=[>($2, 3)])\n LogicalProject(MGR=[$0], HIREDATE=[CURRENT_TIMESTAMP], $f2=[$1])\n LogicalAggregate(group=[{0}], agg#0=[COUNT()])\n LogicalProject(MGR=[$3])\n LogicalFilter(condition=[AND(IS NULL($3), =($4, CURRENT_TIMESTAMP))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateExtractProjectRule.json b/tests/calcite/testAggregateExtractProjectRule.json index 202cae2..b49861a 100644 --- a/tests/calcite/testAggregateExtractProjectRule.json +++ b/tests/calcite/testAggregateExtractProjectRule.json @@ -1,100 +1,54 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "scan" : 0 + } } }, { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "column" : 5, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateExtractProjectRuleWithGroupingSets.json b/tests/calcite/testAggregateExtractProjectRuleWithGroupingSets.json index 5139778..7339c16 100644 --- a/tests/calcite/testAggregateExtractProjectRuleWithGroupingSets.json +++ b/tests/calcite/testAggregateExtractProjectRuleWithGroupingSets.json @@ -1,164 +1,72 @@ { + "help" : [ "LogicalAggregate(group=[{0, 7}], groups=[[{0, 7}, {0}, {7}]], EXPR$2=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}, {2}]], EXPR$2=[SUM($1)])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "scan" : 0 + } } }, { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "column" : 2, + "column" : 5, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + }, { + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 7}], groups=[[{0, 7}, {0}, {7}]], EXPR$2=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}, {2}]], EXPR$2=[SUM($1)])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateExtractProjectRuleWithGroupingSets2.json b/tests/calcite/testAggregateExtractProjectRuleWithGroupingSets2.json index f4fb535..c416e3c 100644 --- a/tests/calcite/testAggregateExtractProjectRuleWithGroupingSets2.json +++ b/tests/calcite/testAggregateExtractProjectRuleWithGroupingSets2.json @@ -1,158 +1,69 @@ { + "help" : [ "LogicalAggregate(group=[{0, 7}], groups=[[{0, 7}, {0}, {7}]], EXPR$2=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {1}]], EXPR$2=[SUM($0)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "scan" : 0 + } } }, { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 7}], groups=[[{0, 7}, {0}, {7}]], EXPR$2=[SUM($0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {1}]], EXPR$2=[SUM($0)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateGroupingSetsProjectMerge.json b/tests/calcite/testAggregateGroupingSetsProjectMerge.json index b953610..db5945c 100644 --- a/tests/calcite/testAggregateGroupingSetsProjectMerge.json +++ b/tests/calcite/testAggregateGroupingSetsProjectMerge.json @@ -1,14 +1,53 @@ { + "help" : [ "LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$1=[SUM($2)])\n LogicalProject(X=[$7], Y=[$0], Z=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\n LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 7}], groups=[[{0, 7}, {7}, {}]], EXPR$1=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ] + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -18,101 +57,48 @@ }, { "column" : 1, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" }, { - "column" : 1, + "column" : 7, "type" : "INTEGER" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 4, + "column" : 5, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "SUM", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" } ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -122,85 +108,7 @@ }, { "column" : 1, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } + } ] } - } ], - "help" : [ "LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$1=[SUM($2)])\n LogicalProject(X=[$7], Y=[$0], Z=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\n LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 7}], groups=[[{0, 7}, {7}, {}]], EXPR$1=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove1.json b/tests/calcite/testAggregateJoinRemove1.json index d9574ca..e01d512 100644 --- a/tests/calcite/testAggregateJoinRemove1.json +++ b/tests/calcite/testAggregateJoinRemove1.json @@ -1,153 +1,68 @@ { + "help" : [ "LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" + }, + "left" : { + "scan" : 0 }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } + "kind" : "LEFT", + "right" : { + "scan" : 1 } } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + }, { + "group" : { + "keys" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "scan" : 0 + } + } + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove10.json b/tests/calcite/testAggregateJoinRemove10.json index 2eb8511..c4d3b0b 100644 --- a/tests/calcite/testAggregateJoinRemove10.json +++ b/tests/calcite/testAggregateJoinRemove10.json @@ -1,188 +1,45 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1, $2)])\n LogicalProject(DEPTNO=[$7], NAME=[$10], NAME0=[$12])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}], EXPR$1=[COUNT(DISTINCT $10, $12)])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 13, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -190,13 +47,12 @@ "column" : 11, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -204,100 +60,96 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "scan" : 1 } } }, + "kind" : "LEFT", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ] } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", + } + } + }, { + "group" : { + "keys" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "column" : 11, - "type" : "VARCHAR" + "column" : 7, + "type" : "INTEGER" }, { - "column" : 13, - "type" : "VARCHAR" + "column" : 11, + "type" : "INTEGER" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { + "operator" : "=" + }, + "left" : { + "join" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - }, - "right" : { - "scan" : 1 - } - } + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "scan" : 1 } } + }, + "kind" : "LEFT", + "right" : { + "scan" : 1 } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1, $2)])\n LogicalProject(DEPTNO=[$7], NAME=[$10], NAME0=[$12])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}], EXPR$1=[COUNT(DISTINCT $10, $12)])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove11.json b/tests/calcite/testAggregateJoinRemove11.json index 0f1cabd..658f71a 100644 --- a/tests/calcite/testAggregateJoinRemove11.json +++ b/tests/calcite/testAggregateJoinRemove11.json @@ -1,177 +1,89 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}], EXPR$1=[COUNT(DISTINCT $8)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" + }, + "left" : { + "scan" : 0 }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } + "kind" : "LEFT", + "right" : { + "scan" : 1 } } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 9, - "type" : "BOOLEAN" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}], EXPR$1=[COUNT(DISTINCT $8)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + }, { + "group" : { + "keys" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 8, + "type" : "BOOLEAN" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "scan" : 0 + } + } + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove2.json b/tests/calcite/testAggregateJoinRemove2.json index 73913d3..e909886 100644 --- a/tests/calcite/testAggregateJoinRemove2.json +++ b/tests/calcite/testAggregateJoinRemove2.json @@ -1,177 +1,89 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}], EXPR$1=[COUNT(DISTINCT $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" + }, + "left" : { + "scan" : 0 }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } + "kind" : "LEFT", + "right" : { + "scan" : 1 } } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + }, { + "column" : 2, + "type" : "VARCHAR" + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}], EXPR$1=[COUNT(DISTINCT $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + }, { + "group" : { + "keys" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "scan" : 0 + } + } + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove3.json b/tests/calcite/testAggregateJoinRemove3.json index 31916c0..c32deee 100644 --- a/tests/calcite/testAggregateJoinRemove3.json +++ b/tests/calcite/testAggregateJoinRemove3.json @@ -1,141 +1,42 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}], EXPR$1=[COUNT(DISTINCT $10)])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -143,73 +44,65 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ] } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", + } + } + }, { + "group" : { + "keys" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "column" : 11, - "type" : "VARCHAR" + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "scan" : 1 } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}], EXPR$1=[COUNT(DISTINCT $10)])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove4.json b/tests/calcite/testAggregateJoinRemove4.json index feab8b1..7654fe4 100644 --- a/tests/calcite/testAggregateJoinRemove4.json +++ b/tests/calcite/testAggregateJoinRemove4.json @@ -1,123 +1,67 @@ { + "help" : [ "LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$9])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } + "left" : { + "scan" : 0 + }, + "kind" : "RIGHT", + "right" : { + "scan" : 1 } } - } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ] } - } ] + } } }, { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$9])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove5.json b/tests/calcite/testAggregateJoinRemove5.json index b4f4836..1d953ca 100644 --- a/tests/calcite/testAggregateJoinRemove5.json +++ b/tests/calcite/testAggregateJoinRemove5.json @@ -1,177 +1,89 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "left" : { + "scan" : 0 }, - "source" : { + "kind" : "RIGHT", + "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "scan" : 1 + } + } + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove6.json b/tests/calcite/testAggregateJoinRemove6.json index ed48480..2c35c97 100644 --- a/tests/calcite/testAggregateJoinRemove6.json +++ b/tests/calcite/testAggregateJoinRemove6.json @@ -1,141 +1,42 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$9], JOB=[$2])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{9}], EXPR$1=[COUNT(DISTINCT $2)])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "RIGHT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -143,73 +44,65 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "RIGHT", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ] } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", + } + } + }, { + "group" : { + "keys" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "column" : 3, - "type" : "VARCHAR" + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "RIGHT", + "right" : { + "scan" : 1 } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$9], JOB=[$2])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{9}], EXPR$1=[COUNT(DISTINCT $2)])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove7.json b/tests/calcite/testAggregateJoinRemove7.json index 8b6ba0d..239dcce 100644 --- a/tests/calcite/testAggregateJoinRemove7.json +++ b/tests/calcite/testAggregateJoinRemove7.json @@ -1,229 +1,106 @@ { + "help" : [ "LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "column" : 9, + "column" : 11, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 8, + "column" : 7, "type" : "INTEGER" }, { - "column" : 10, + "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "scan" : 1 } } + }, + "kind" : "LEFT", + "right" : { + "scan" : 1 } } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "scan" : 1 } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove8.json b/tests/calcite/testAggregateJoinRemove8.json index 34f01c2..7751390 100644 --- a/tests/calcite/testAggregateJoinRemove8.json +++ b/tests/calcite/testAggregateJoinRemove8.json @@ -1,253 +1,127 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], NAME0=[$12])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}], EXPR$1=[COUNT(DISTINCT $10)])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "column" : 9, + "column" : 11, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 11, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 8, + "column" : 7, "type" : "INTEGER" }, { - "column" : 10, + "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "scan" : 1 } } + }, + "kind" : "LEFT", + "right" : { + "scan" : 1 } } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "VARCHAR" + } ] + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "scan" : 1 } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], NAME0=[$12])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7}], EXPR$1=[COUNT(DISTINCT $10)])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateJoinRemove9.json b/tests/calcite/testAggregateJoinRemove9.json index 6765b33..f76efc8 100644 --- a/tests/calcite/testAggregateJoinRemove9.json +++ b/tests/calcite/testAggregateJoinRemove9.json @@ -1,261 +1,115 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], NAME=[$12])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7, 10}])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 14, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "column" : 9, + "column" : 11, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 9, + "column" : 7, "type" : "INTEGER" }, { - "column" : 11, + "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "scan" : 1 } } + }, + "kind" : "LEFT", + "right" : { + "scan" : 1 } } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "VARCHAR" + } ] + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "scan" : 1 } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], NAME=[$12])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{7, 10}])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateMerge1.json b/tests/calcite/testAggregateMerge1.json index b7488b7..4ba7971 100644 --- a/tests/calcite/testAggregateMerge1.json +++ b/tests/calcite/testAggregateMerge1.json @@ -1,365 +1,175 @@ { + "help" : [ "LogicalAggregate(group=[{1}], EXPR$1=[MIN($4)], Z=[MAX($3)], EXPR$3=[SUM($6)], N=[SUM($5)], SAL=[SUM($2)])\n LogicalAggregate(group=[{1, 7}], X=[SUM($5)], Z=[MAX($5)], Y=[MIN($5)], M=[COUNT()], R=[COUNT($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{7}], EXPR$1=[MIN($5)], Z=[MAX($5)], EXPR$3=[COUNT($3)], N=[COUNT()], SAL=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, "type" : "INTEGER" } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", + "type" : "INTEGER", "operand" : [ { - "column" : 4, + "column" : 5, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { "operator" : "SUM", - "operand" : [ { - "column" : 7, - "type" : "BIGINT" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "ignoreNulls" : false }, { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "BIGINT" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "SUM", + "type" : "INTEGER", "operand" : [ { - "column" : 3, + "column" : 5, "type" : "INTEGER" } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", + "type" : "INTEGER", "operand" : [ { - "column" : 6, + "column" : 5, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "MIN", + "ignoreNulls" : false }, { - "operator" : "MAX", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { + "type" : "BIGINT", + "operand" : [ ], "operator" : "COUNT", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "ignoreNulls" : false }, { - "operator" : "COUNT", - "operand" : [ ], "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "SUM", + "type" : "BIGINT", "operand" : [ { - "column" : 6, + "column" : 3, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } + "scan" : 0 } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{1}], EXPR$1=[MIN($4)], Z=[MAX($3)], EXPR$3=[SUM($6)], N=[SUM($5)], SAL=[SUM($2)])\n LogicalAggregate(group=[{1, 7}], X=[SUM($5)], Z=[MAX($5)], Y=[MIN($5)], M=[COUNT()], R=[COUNT($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{7}], EXPR$1=[MIN($5)], Z=[MAX($5)], EXPR$3=[COUNT($3)], N=[COUNT()], SAL=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + }, { + "group" : { + "keys" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "scan" : 0 + } + } + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateMerge2.json b/tests/calcite/testAggregateMerge2.json index 75e6723..6b02575 100644 --- a/tests/calcite/testAggregateMerge2.json +++ b/tests/calcite/testAggregateMerge2.json @@ -1,266 +1,81 @@ { + "help" : [ "LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$2=[$2], EXPR$3=[$3])\n LogicalAggregate(group=[{0, 2}], groups=[[{0}, {2}]], EXPR$2=[SUM($3)], EXPR$3=[SUM($4)])\n LogicalAggregate(group=[{0, 1, 7}], X=[SUM($5)], Y=[COUNT($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$2=[$2], EXPR$3=[$3])\n LogicalAggregate(group=[{0, 7}], groups=[[{0}, {7}]], EXPR$2=[SUM($5)], EXPR$3=[COUNT($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "BIGINT" - } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" }, { - "column" : 2, + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, "type" : "INTEGER" } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { "column" : 5, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 6, - "type" : "BIGINT" + "column" : 3, + "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } + "scan" : 0 } } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "INTEGER" @@ -273,80 +88,56 @@ }, { "column" : 3, "type" : "BIGINT" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "scan" : 0 + } } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$2=[$2], EXPR$3=[$3])\n LogicalAggregate(group=[{0, 2}], groups=[[{0}, {2}]], EXPR$2=[SUM($3)], EXPR$3=[SUM($4)])\n LogicalAggregate(group=[{0, 1, 7}], X=[SUM($5)], Y=[COUNT($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$2=[$2], EXPR$3=[$3])\n LogicalAggregate(group=[{0, 7}], groups=[[{0}, {7}]], EXPR$2=[SUM($5)], EXPR$3=[COUNT($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateMerge8.json b/tests/calcite/testAggregateMerge8.json index 73a23e4..838e22a 100644 --- a/tests/calcite/testAggregateMerge8.json +++ b/tests/calcite/testAggregateMerge8.json @@ -1,188 +1,88 @@ { + "help" : [ "LogicalAggregate(group=[{}], X=[SUM($0)], Z=[MIN($1)])\n LogicalAggregate(group=[{}], X=[SUM($5)], Y=[MIN($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], X=[SUM($5)], Z=[MIN($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false }, { - "aggregate" : { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ ], "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", + "type" : "INTEGER", "operand" : [ { "column" : 5, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "SUM", + "ignoreNulls" : false }, { - "operator" : "MIN", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { "column" : 5, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "MIN", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } + "scan" : 0 } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], X=[SUM($0)], Z=[MIN($1)])\n LogicalAggregate(group=[{}], X=[SUM($5)], Y=[MIN($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], X=[SUM($5)], Z=[MIN($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + }, { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "scan" : 0 + } + } + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateMergeSum0.json b/tests/calcite/testAggregateMergeSum0.json index 3fbb854..f784ec0 100644 --- a/tests/calcite/testAggregateMergeSum0.json +++ b/tests/calcite/testAggregateMergeSum0.json @@ -1,195 +1,61 @@ { + "help" : [ "LogicalAggregate(group=[{}], agg#0=[$SUM0($2)])\n LogicalAggregate(group=[{3, 7}], COUNT_COMM=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } + "scan" : 0 } } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "scan" : 0 + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], agg#0=[$SUM0($2)])\n LogicalAggregate(group=[{3, 7}], COUNT_COMM=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateProjectMerge.json b/tests/calcite/testAggregateProjectMerge.json index fee5108..42f8ac5 100644 --- a/tests/calcite/testAggregateProjectMerge.json +++ b/tests/calcite/testAggregateProjectMerge.json @@ -1,14 +1,53 @@ { + "help" : [ "LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM($2)])\n LogicalProject(X=[$7], Y=[$0], Z=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\n LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 7}], EXPR$1=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ] + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -18,101 +57,48 @@ }, { "column" : 1, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" }, { - "column" : 1, + "column" : 7, "type" : "INTEGER" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 4, + "column" : 5, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "SUM", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" } ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -122,85 +108,7 @@ }, { "column" : 1, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } + } ] } - } ], - "help" : [ "LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM($2)])\n LogicalProject(X=[$7], Y=[$0], Z=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(X=[$0], EXPR$1=[$2], Y=[$1])\n LogicalProject(DEPTNO=[$1], EMPNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 7}], EXPR$1=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateProjectPullUpConstants.json b/tests/calcite/testAggregateProjectPullUpConstants.json index ceeb301..8446698 100644 --- a/tests/calcite/testAggregateProjectPullUpConstants.json +++ b/tests/calcite/testAggregateProjectPullUpConstants.json @@ -1,281 +1,136 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1, 2}], S=[SUM($2)])\n LogicalProject(JOB=[$2], EMPNO=[$0], SAL=[$5])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(JOB=[$0], EMPNO=[10], SAL=[$1], S=[$2])\n LogicalAggregate(group=[{0, 1}], S=[SUM($1)])\n LogicalProject(JOB=[$2], SAL=[$5])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { - "column" : 0, + "column" : 2, "type" : "VARCHAR" }, { - "column" : 1, + "column" : 0, "type" : "INTEGER" }, { - "column" : 2, + "column" : 5, + "type" : "INTEGER" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, "type" : "INTEGER" } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], "source" : { "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" }, - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ] } } } - } ] - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { "column" : 1, "type" : "INTEGER" }, { "column" : 2, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1, 2}], S=[SUM($2)])\n LogicalProject(JOB=[$2], EMPNO=[$0], SAL=[$5])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(JOB=[$0], EMPNO=[10], SAL=[$1], S=[$2])\n LogicalAggregate(group=[{0, 1}], S=[SUM($1)])\n LogicalProject(JOB=[$2], SAL=[$5])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateProjectPullUpConstants2.json b/tests/calcite/testAggregateProjectPullUpConstants2.json index 5e951aa..be40420 100644 --- a/tests/calcite/testAggregateProjectPullUpConstants2.json +++ b/tests/calcite/testAggregateProjectPullUpConstants2.json @@ -1,36 +1,65 @@ { + "help" : [ "LogicalAggregate(group=[{1, 5}])\n LogicalFilter(condition=[=($1, 'John')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(ENAME=['John':VARCHAR(20)], SAL=[$0])\n LogicalAggregate(group=[{5}])\n LogicalFilter(condition=[=($1, 'John')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'John'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 5, "type" : "INTEGER" } ], + "function" : [ ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'John'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'John'" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 @@ -38,144 +67,15 @@ } } } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'John'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "project" : { + }, "target" : [ { - "operator" : "_ISO-8859-1'John'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'John'" }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'John'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'John'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{1, 5}])\n LogicalFilter(condition=[=($1, 'John')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(ENAME=['John':VARCHAR(20)], SAL=[$0])\n LogicalAggregate(group=[{5}])\n LogicalFilter(condition=[=($1, 'John')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateRemove1.json b/tests/calcite/testAggregateRemove1.json index 9cb4ee0..ca65b24 100644 --- a/tests/calcite/testAggregateRemove1.json +++ b/tests/calcite/testAggregateRemove1.json @@ -1,14 +1,107 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], EXPR$1=[$2], EXPR$2=[$3], EXPR$3=[$4], EXPR$4=[$5], EXPR$5=[$6], EXPR$6=[$7], EXPR$7=[$8])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM($2)], EXPR$2=[MIN($2)], EXPR$3=[MAX($2)], EXPR$4=[BIT_AND($2)], EXPR$5=[BIT_OR($2)], EXPR$6=[COUNT(DISTINCT $2)], EXPR$7=[GROUPING($1)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], EXPR$1=[$5], EXPR$2=[$5], EXPR$3=[$5], EXPR$4=[$5], EXPR$5=[$5], EXPR$6=[1:BIGINT], EXPR$7=[0:BIGINT])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "BIT_AND", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "BIT_OR", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "GROUPING", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ] + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -30,146 +123,16 @@ }, { "column" : 7, "type" : "BIGINT" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "BIT_AND", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "BIT_OR", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + }, { + "column" : 8, + "type" : "BIGINT" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -189,14 +152,14 @@ "column" : 5, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "BIGINT", "operand" : [ ], - "type" : "BIGINT" - } ], - "source" : { - "scan" : 0 - } + "operator" : "1" + }, { + "type" : "BIGINT", + "operand" : [ ], + "operator" : "0" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], EXPR$1=[$2], EXPR$2=[$3], EXPR$3=[$4], EXPR$4=[$5], EXPR$5=[$6], EXPR$6=[$7])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM($2)], EXPR$2=[MIN($2)], EXPR$3=[MAX($2)], EXPR$4=[BIT_AND($2)], EXPR$5=[BIT_OR($2)], EXPR$6=[COUNT(DISTINCT $2)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], EXPR$1=[$5], EXPR$2=[$5], EXPR$3=[$5], EXPR$4=[$5], EXPR$5=[$5], EXPR$6=[1:BIGINT])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateRemove2.json b/tests/calcite/testAggregateRemove2.json index 16e1f3d..0d05918 100644 --- a/tests/calcite/testAggregateRemove2.json +++ b/tests/calcite/testAggregateRemove2.json @@ -1,100 +1,50 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "column" : 1, + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + } ] } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] + } } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateRemove3.json b/tests/calcite/testAggregateRemove3.json index 057e230..e05d79f 100644 --- a/tests/calcite/testAggregateRemove3.json +++ b/tests/calcite/testAggregateRemove3.json @@ -1,142 +1,89 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT($2)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], EXPR$1=[CASE(IS NOT NULL($3), 1:BIGINT, 0:BIGINT)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "BIGINT" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "column" : 1, + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + }, { + "column" : 3, + "type" : "INTEGER" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "CASE", + "type" : "BIGINT", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "1", + "type" : "BIGINT", "operand" : [ ], - "type" : "BIGINT" + "operator" : "1" }, { - "operator" : "0", + "type" : "BIGINT", "operand" : [ ], - "type" : "BIGINT" + "operator" : "0" } ], - "type" : "BIGINT" - } ], - "source" : { - "scan" : 0 - } + "operator" : "CASE" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT($2)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], EXPR$1=[CASE(IS NOT NULL($3), 1:BIGINT, 0:BIGINT)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateRemove7.json b/tests/calcite/testAggregateRemove7.json index 5cdf791..977afec 100644 --- a/tests/calcite/testAggregateRemove7.json +++ b/tests/calcite/testAggregateRemove7.json @@ -1,408 +1,158 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(MGR=[$0], SUM_SAL=[$2])\n LogicalFilter(condition=[=($1, 100)])\n LogicalAggregate(group=[{0, 1}], SUM_SAL=[SUM($2)])\n LogicalProject(MGR=[$3], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(MGR=[$0], SUM_SAL=[$2])\n LogicalFilter(condition=[=($1, 100)])\n LogicalAggregate(group=[{0, 1}], SUM_SAL=[SUM($2)])\n LogicalProject(MGR=[$3], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "100", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "project" : { - "target" : [ { - "column" : 1, + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" }, { - "column" : 3, + "column" : 1, "type" : "INTEGER" } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "100", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ] } } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ] } - } ] + } } }, { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 3, "type" : "INTEGER" }, { - "column" : 1, + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + }, { + "column" : 5, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(MGR=[$0], SUM_SAL=[$2])\n LogicalFilter(condition=[=($1, 100)])\n LogicalAggregate(group=[{0, 1}], SUM_SAL=[SUM($2)])\n LogicalProject(MGR=[$3], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(MGR=[$0], SUM_SAL=[$2])\n LogicalFilter(condition=[=($1, 100)])\n LogicalAggregate(group=[{0, 1}], SUM_SAL=[SUM($2)])\n LogicalProject(MGR=[$3], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateUnionTransposeWithOneInputUnique.json b/tests/calcite/testAggregateUnionTransposeWithOneInputUnique.json index 620bff7..107dc77 100644 --- a/tests/calcite/testAggregateUnionTransposeWithOneInputUnique.json +++ b/tests/calcite/testAggregateUnionTransposeWithOneInputUnique.json @@ -1,836 +1,168 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], T=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], T=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(DEPTNO=[$7], T=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], T=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "operator" : "2" } ] } - } ] + } } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, + } ] + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" } ] } } } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } ] - } - } ] - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" } ] } - } ] + } } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], T=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], T=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(DEPTNO=[$7], T=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], T=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json b/tests/calcite/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json index 3982c58..b0b503b 100644 --- a/tests/calcite/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json +++ b/tests/calcite/testAggregateUnionTransposeWithTopLevelGroupSetRemapping.json @@ -1,720 +1,246 @@ { + "help" : [ "LogicalProject(EXPR$0=[$1], T2=[$0])\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT($0)])\n LogicalUnion(all=[true])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1], T2=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT($0)])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT($0)])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + } ], + "operator" : "CASE" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] + } + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + } ], + "operator" : "CASE" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ] + } + } ] + } + } + }, "target" : [ { "column" : 1, "type" : "BIGINT" }, { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "INTEGER" + "operator" : "CASE" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "1" + } ] } - }, { + } + } + }, { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "INTEGER" + "operator" : "CASE" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } + "operator" : "2" } ] } } } - } - } ] + } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "BIGINT" }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } ] - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } ] - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$1], T2=[$0])\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT($0)])\n LogicalUnion(all=[true])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1], T2=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT($0)])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT($0)])\n LogicalProject(T1=[CASE(=($7, 0), 1, null:INTEGER)], T2=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAll.json b/tests/calcite/testAll.json index 4051f7a..33f05aa 100644 --- a/tests/calcite/testAll.json +++ b/tests/calcite/testAll.json @@ -1,82 +1,52 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[NOT(<= SOME($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n}))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[NOT(CAST(OR(AND(IS TRUE(<=($0, $9)), <>($10, 0)), AND(>($10, $11), null, <>($10, 0), IS NOT TRUE(<=($0, $9))), AND(<=($0, $9), <>($10, 0), IS NOT TRUE(<=($0, $9)), <=($10, $11)))):BOOLEAN NOT NULL)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(m=[$0], c=[$1], d=[$1])\n LogicalAggregate(group=[{}], m=[MAX($0)], c=[COUNT()])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], - "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] - }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "NOT", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<= SOME", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "query" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 9, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "<= SOME" } ], - "type" : "BOOLEAN" + "operator" : "NOT" }, "source" : { - "scan" : 0 + "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -104,51 +74,26 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "NOT", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "CAST", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -156,26 +101,26 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "<=" } ], - "type" : "BOOLEAN" + "operator" : "IS TRUE" }, { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "<>" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" @@ -183,26 +128,26 @@ "column" : 11, "type" : "BIGINT" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "NULL", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "NULL" }, { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "<>" }, { - "operator" : "IS NOT TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -210,15 +155,15 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "<=" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT TRUE" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -226,22 +171,22 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "<=" }, { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "<>" }, { - "operator" : "IS NOT TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -249,11 +194,11 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "<=" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT TRUE" }, { - "operator" : "<=", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" @@ -261,29 +206,61 @@ "column" : 11, "type" : "BIGINT" } ], - "type" : "BOOLEAN" + "operator" : "<=" } ], - "type" : "BOOLEAN" + "operator" : "AND" } ], - "type" : "BOOLEAN" + "operator" : "OR" } ], - "type" : "BOOLEAN" + "operator" : "CAST" } ], - "type" : "BOOLEAN" + "operator" : "NOT" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { - "scan" : 0 + "scan" : 1 }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -293,75 +270,71 @@ }, { "column" : 1, "type" : "BIGINT" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - } + } ] } } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[NOT(<= SOME($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n}))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[NOT(CAST(OR(AND(IS TRUE(<=($0, $9)), <>($10, 0)), AND(>($10, $11), null, <>($10, 0), IS NOT TRUE(<=($0, $9))), AND(<=($0, $9), <>($10, 0), IS NOT TRUE(<=($0, $9)), <=($10, $11)))):BOOLEAN NOT NULL)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(m=[$0], c=[$1], d=[$1])\n LogicalAggregate(group=[{}], m=[MAX($0)], c=[COUNT()])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAlreadyFalseEliminatesFilter.json b/tests/calcite/testAlreadyFalseEliminatesFilter.json index 4adf54f..7f4afc3 100644 --- a/tests/calcite/testAlreadyFalseEliminatesFilter.json +++ b/tests/calcite/testAlreadyFalseEliminatesFilter.json @@ -1,54 +1,54 @@ { + "help" : [ "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalFilter(condition=[false])\n LogicalValues(tuples=[[{ 1, 2 }]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[]])\n" ], "schemas" : [ ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "false", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "false" }, "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ [ { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ] ] } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalFilter(condition=[false])\n LogicalValues(tuples=[[{ 1, 2 }]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAntiCorrelateWithLeftEmpty.json b/tests/calcite/testAntiCorrelateWithLeftEmpty.json new file mode 100644 index 0000000..25a723b --- /dev/null +++ b/tests/calcite/testAntiCorrelateWithLeftEmpty.json @@ -0,0 +1,45 @@ +{ + "help" : [ "LogicalCorrelate(correlation=[$cor0], joinType=[anti], requiredColumns=[{7}])\n LogicalValues(tuples=[[]])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalValues(tuples=[[]])\n" ], + "schemas" : [ { + "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "nullable" : [ false, true, true ], + "name" : "scott.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ] + } ], + "queries" : [ { + "correlate" : { + "left" : { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "content" : [ ] + } + }, + "kind" : "ANTI", + "right" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 8, + "type" : "TINYINT" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "content" : [ ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testAntiCorrelateWithRightEmpty.json b/tests/calcite/testAntiCorrelateWithRightEmpty.json new file mode 100644 index 0000000..3ec263b --- /dev/null +++ b/tests/calcite/testAntiCorrelateWithRightEmpty.json @@ -0,0 +1,27 @@ +{ + "help" : [ "LogicalCorrelate(correlation=[$cor0], joinType=[anti], requiredColumns=[{7}])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n", "LogicalTableScan(table=[[scott, EMP]])\n" ], + "schemas" : [ { + "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "nullable" : [ false, true, true, true, true, true, true, true ], + "name" : "scott.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "key" : [ [ 0 ], [ 1 ] ] + } ], + "queries" : [ { + "correlate" : { + "left" : { + "scan" : 0 + }, + "kind" : "ANTI", + "right" : { + "values" : { + "schema" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "content" : [ ] + } + } + } + }, { + "scan" : 0 + } ] +} \ No newline at end of file diff --git a/tests/calcite/testAntiJoinProjectTranspose.json b/tests/calcite/testAntiJoinProjectTranspose.json index 93dfc54..e1bceeb 100644 --- a/tests/calcite/testAntiJoinProjectTranspose.json +++ b/tests/calcite/testAntiJoinProjectTranspose.json @@ -1,30 +1,19 @@ { + "help" : [ "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[anti])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[anti])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalProject($f0=[$0])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "DNAME", "LOC" ], "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ], [ 2 ] ], - "foreign" : [ ] - }, { - "name" : "DEPT", + "nullable" : [ false, true, true ], + "name" : "scott.DEPT", + "guaranteed" : [ ], "fields" : [ "DEPTNO", "DNAME", "LOC" ], - "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ], [ 2 ] ], - "foreign" : [ ] + "key" : [ [ 0 ], [ 1 ], [ 2 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "ANTI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "TINYINT" @@ -32,98 +21,53 @@ "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "ANTI", "right" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "*", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "TINYINT" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "*", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "TINYINT" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } + "scan" : 0 + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + }, { + "column" : 0, + "type" : "TINYINT" + } ], + "operator" : "*" + } ] } - } ] + } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "ANTI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "TINYINT" @@ -131,106 +75,65 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "TINYINT" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } }, + "kind" : "ANTI", "right" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "operator" : "*", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "TINYINT" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "*", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "TINYINT" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "scan" : 0 + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + }, { + "column" : 0, + "type" : "TINYINT" + } ], + "operator" : "*" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[anti])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[anti])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalProject($f0=[$0])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAnyInProjectNonNullable.json b/tests/calcite/testAnyInProjectNonNullable.json index 373d1da..167e9cf 100644 --- a/tests/calcite/testAnyInProjectNonNullable.json +++ b/tests/calcite/testAnyInProjectNonNullable.json @@ -1,62 +1,122 @@ { + "help" : [ "LogicalProject(NAME=[$1], EXPR$1=[> SOME($0, {\nLogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$1], EXPR$1=[CAST(OR(AND(IS TRUE(>($0, $2)), <>($3, 0)), AND(>($3, $4), null, <>($3, 0), IS NOT TRUE(>($0, $2))), AND(>($0, $2), <>($3, 0), IS NOT TRUE(>($0, $2)), <=($3, $4)))):BOOLEAN NOT NULL])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(m=[$0], c=[$1], d=[$1])\n LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], - "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] - }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR" ], + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "> SOME", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "query" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 9, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } }, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "> SOME" + } ] } }, { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, + "left" : { + "scan" : 1 + }, + "kind" : "INNER", + "right" : { + "project" : { + "source" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 1, + "type" : "BIGINT" + } ] + } + } + } + }, "target" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "CAST", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -64,26 +124,26 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "IS TRUE" }, { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "<>" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "BIGINT" @@ -91,26 +151,26 @@ "column" : 4, "type" : "BIGINT" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "NULL", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "NULL" }, { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "<>" }, { - "operator" : "IS NOT TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -118,15 +178,15 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT TRUE" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -134,22 +194,22 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "<>" }, { - "operator" : "IS NOT TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -157,11 +217,11 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT TRUE" }, { - "operator" : "<=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "BIGINT" @@ -169,101 +229,14 @@ "column" : 4, "type" : "BIGINT" } ], - "type" : "BOOLEAN" + "operator" : "<=" } ], - "type" : "BOOLEAN" + "operator" : "AND" } ], - "type" : "BOOLEAN" + "operator" : "OR" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 1, - "type" : "BIGINT" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - } - } - } - } - } + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalProject(NAME=[$1], EXPR$1=[> SOME($0, {\nLogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$1], EXPR$1=[CAST(OR(AND(IS TRUE(>($0, $2)), <>($3, 0)), AND(>($3, $4), null, <>($3, 0), IS NOT TRUE(>($0, $2))), AND(>($0, $2), <>($3, 0), IS NOT TRUE(>($0, $2)), <=($3, $4)))):BOOLEAN NOT NULL])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(m=[$0], c=[$1], d=[$1])\n LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testAnyInProjectNullable.json b/tests/calcite/testAnyInProjectNullable.json index 6a33e15..921b646 100644 --- a/tests/calcite/testAnyInProjectNullable.json +++ b/tests/calcite/testAnyInProjectNullable.json @@ -1,80 +1,168 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], EXPR$1=[IN($1, {\nLogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[OR(AND(IS NOT NULL($5), <>($2, 0)), AND(<($3, $2), null, <>($2, 0), IS NULL($5)))])\n LogicalJoin(condition=[=($1, $4)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], i=[LITERAL_AGG(true)])\n LogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], - "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] - }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR" ], + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "IN", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "query" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 5, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } }, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "IN" + } ] } }, { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, + "left" : { + "scan" : 1 + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ] + } + } + } + } + } + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "LITERAL_AGG", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ] + } + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "<>" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "BIGINT" @@ -82,201 +170,34 @@ "column" : 2, "type" : "BIGINT" } ], - "type" : "BOOLEAN" + "operator" : "<" }, { - "operator" : "NULL", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "NULL" }, { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "<>" }, { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" } ], - "type" : "BOOLEAN" + "operator" : "AND" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - } - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - } - } - } + "operator" : "OR" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], EXPR$1=[IN($1, {\nLogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[OR(AND(IS NOT NULL($5), <>($2, 0)), AND(<($3, $2), null, <>($2, 0), IS NULL($5)))])\n LogicalJoin(condition=[=($1, $4)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(MGR=[$3], i=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testBitAndReuseDistinctAttrWithMixedOptionality.json b/tests/calcite/testBitAndReuseDistinctAttrWithMixedOptionality.json index 0b6734d..c203456 100644 --- a/tests/calcite/testBitAndReuseDistinctAttrWithMixedOptionality.json +++ b/tests/calcite/testBitAndReuseDistinctAttrWithMixedOptionality.json @@ -1,244 +1,107 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[BIT_AND($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT($0)], EXPR$2=[BIT_AND($0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : true, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "BIT_AND", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "BIT_AND", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "BIT_AND", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "BIT_AND", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" } ], + "function" : [ ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[BIT_AND($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT($0)], EXPR$2=[BIT_AND($0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testBitOrReuseDistinctAttrWithMixedOptionality.json b/tests/calcite/testBitOrReuseDistinctAttrWithMixedOptionality.json index ca0475d..0e22a68 100644 --- a/tests/calcite/testBitOrReuseDistinctAttrWithMixedOptionality.json +++ b/tests/calcite/testBitOrReuseDistinctAttrWithMixedOptionality.json @@ -1,244 +1,107 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[BIT_OR($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT($0)], EXPR$2=[BIT_OR($0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : true, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "BIT_OR", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "BIT_OR", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "BIT_OR", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "BIT_OR", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" } ], + "function" : [ ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[BIT_OR($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT($0)], EXPR$2=[BIT_OR($0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testCasePushIsAlwaysWorking.json b/tests/calcite/testCasePushIsAlwaysWorking.json index 08d5b0a..a4816f9 100644 --- a/tests/calcite/testCasePushIsAlwaysWorking.json +++ b/tests/calcite/testCasePushIsAlwaysWorking.json @@ -1,35 +1,32 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=(CASE(>($5, 1000), $0, $5), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(AND(>($5, 1000), =($0, 1)), =($5, 1))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "1000", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1000" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { "column" : 0, "type" : "INTEGER" @@ -37,76 +34,79 @@ "column" : 5, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CASE" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "1000", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1000" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=(CASE(>($5, 1000), $0, $5), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(AND(>($5, 1000), =($0, 1)), =($5, 1))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testCastInAggregateExpandDistinctAggregatesRule.json b/tests/calcite/testCastInAggregateExpandDistinctAggregatesRule.json index 1daa893..fc3d7dd 100644 --- a/tests/calcite/testCastInAggregateExpandDistinctAggregatesRule.json +++ b/tests/calcite/testCastInAggregateExpandDistinctAggregatesRule.json @@ -1,251 +1,109 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM(DISTINCT $1)], EXPR$2=[SUM(DISTINCT $2)])\n LogicalAggregate(group=[{0}], CN=[COUNT()], SM=[SUM($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[CAST($1):BIGINT NOT NULL], EXPR$2=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) FILTER $3], EXPR$2=[SUM($2) FILTER $4])\n LogicalProject(NAME=[$0], CN=[$1], SM=[$2], $g_1=[=($3, 1)], $g_2=[=($3, 2)])\n LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1}, {0, 2}]], $g=[GROUPING($0, $1, $2)])\n LogicalAggregate(group=[{0}], CN=[COUNT()], SM=[SUM($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "VARCHAR" } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 0, + "type" : "INTEGER" } ] } } } - }, { - "aggregate" : { + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], "function" : [ { - "operator" : "SUM", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 2, + "column" : 1, "type" : "BIGINT" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 3, + "column" : 2, "type" : "INTEGER" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "SUM", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } ] - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 1, - "type" : "BIGINT" - } ], - "type" : "BIGINT" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { "column" : 0, "type" : "VARCHAR" }, { @@ -254,577 +112,117 @@ }, { "column" : 2, "type" : "INTEGER" - }, { - "operator" : "=", + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 3, - "type" : "BIGINT" + "column" : 0, + "type" : "VARCHAR" }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, + "column" : 1, "type" : "BIGINT" }, { - "operator" : "2", - "operand" : [ ], + "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "GROUPING", + "ignoreNulls" : false } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "GROUPING", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "BIGINT" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 4, - "type" : "BIGINT" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } ] - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { + "group" : { + "keys" : [ { "column" : 0, "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "BIGINT" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false }, { - "operator" : "=", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "2", - "operand" : [ ], + "column" : 1, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "SUM", + "ignoreNulls" : false } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "BIGINT" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ { - "operator" : "GROUPING", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "BIGINT" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "column" : 5, - "type" : "BIGINT" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } + "column" : 0, + "type" : "INTEGER" } ] } } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ], + "operator" : "=" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + } ], + "operator" : "CAST" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM(DISTINCT $1)], EXPR$2=[SUM(DISTINCT $2)])\n LogicalAggregate(group=[{0}], CN=[COUNT()], SM=[SUM($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[CAST($1):BIGINT NOT NULL], EXPR$2=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) FILTER $3], EXPR$2=[SUM($2) FILTER $4])\n LogicalProject(NAME=[$0], CN=[$1], SM=[$2], $g_1=[=($3, 1)], $g_2=[=($3, 2)])\n LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1}, {0, 2}]], $g=[GROUPING($0, $1, $2)])\n LogicalAggregate(group=[{0}], CN=[COUNT()], SM=[SUM($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testCastInAggregateReduceFunctions.json b/tests/calcite/testCastInAggregateReduceFunctions.json index 2b77b87..31a4a0d 100644 --- a/tests/calcite/testCastInAggregateReduceFunctions.json +++ b/tests/calcite/testCastInAggregateReduceFunctions.json @@ -1,139 +1,168 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[STDDEV_SAMP($1)], EXPR$4=[VAR_POP($1)], EXPR$5=[VAR_SAMP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[CAST(POWER(/(-($1, /(*($2, $2), $3)), $3), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[CAST(POWER(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1))), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$4=[CAST(/(-($1, /(*($2, $2), $3)), $3)):INTEGER NOT NULL], EXPR$5=[CAST(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1)))):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($2)], agg#1=[$SUM0($1)], agg#2=[COUNT()])\n LogicalProject(NAME=[$0], DEPTNO=[$1], $f2=[*($1, $1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "STDDEV_POP", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "STDDEV_SAMP", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "VAR_POP", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "VAR_SAMP", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "VARCHAR" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "STDDEV_POP", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "AVG", + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "$SUM0", + "ignoreNulls" : false }, { - "operator" : "STDDEV_SAMP", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "VAR_POP", + "type" : "INTEGER", "operand" : [ { - "column" : 2, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "$SUM0", + "ignoreNulls" : false }, { - "operator" : "VAR_SAMP", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 2, + "column" : 1, "type" : "VARCHAR" }, { - "column" : 1, + "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "*" + } ] } } } - } ] - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "POWER", + "type" : "DOUBLE", "operand" : [ { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { - "operator" : "-", + "type" : "BIGINT", "operand" : [ { "column" : 1, "type" : "INTEGER" }, { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -141,31 +170,31 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" }, { "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "BIGINT" + "operator" : "-" }, { "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" }, { - "operator" : "0.5", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "0.5" } ], - "type" : "DOUBLE" + "operator" : "POWER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -173,24 +202,24 @@ "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "POWER", + "type" : "DOUBLE", "operand" : [ { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { - "operator" : "-", + "type" : "BIGINT", "operand" : [ { "column" : 1, "type" : "INTEGER" }, { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -198,67 +227,67 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" }, { "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "BIGINT" + "operator" : "-" }, { - "operator" : "CASE", + "type" : "BIGINT", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "BIGINT" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "NULL", + "type" : "BIGINT", "operand" : [ ], - "type" : "BIGINT" + "operator" : "NULL" }, { - "operator" : "-", + "type" : "BIGINT", "operand" : [ { "column" : 3, "type" : "BIGINT" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BIGINT" + "operator" : "-" } ], - "type" : "BIGINT" + "operator" : "CASE" } ], - "type" : "BIGINT" + "operator" : "/" }, { - "operator" : "0.5", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "0.5" } ], - "type" : "DOUBLE" + "operator" : "POWER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { - "operator" : "-", + "type" : "BIGINT", "operand" : [ { "column" : 1, "type" : "INTEGER" }, { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -266,34 +295,34 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" }, { "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "BIGINT" + "operator" : "-" }, { "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { - "operator" : "-", + "type" : "BIGINT", "operand" : [ { "column" : 1, "type" : "INTEGER" }, { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -301,179 +330,49 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" }, { "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "BIGINT" + "operator" : "-" }, { - "operator" : "CASE", + "type" : "BIGINT", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "BIGINT" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "NULL", + "type" : "BIGINT", "operand" : [ ], - "type" : "BIGINT" + "operator" : "NULL" }, { - "operator" : "-", + "type" : "BIGINT", "operand" : [ { "column" : 3, "type" : "BIGINT" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BIGINT" + "operator" : "-" } ], - "type" : "BIGINT" + "operator" : "CASE" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "$SUM0", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - } + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[STDDEV_SAMP($1)], EXPR$4=[VAR_POP($1)], EXPR$5=[VAR_SAMP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[CAST(POWER(/(-($1, /(*($2, $2), $3)), $3), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[CAST(POWER(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1))), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$4=[CAST(/(-($1, /(*($2, $2), $3)), $3)):INTEGER NOT NULL], EXPR$5=[CAST(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1)))):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($2)], agg#1=[$SUM0($1)], agg#2=[COUNT()])\n LogicalProject(NAME=[$0], DEPTNO=[$1], $f2=[*($1, $1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testCorrelateWithoutCorrelationToEmpty.json b/tests/calcite/testCorrelateWithoutCorrelationToEmpty.json new file mode 100644 index 0000000..4ceeeb0 --- /dev/null +++ b/tests/calcite/testCorrelateWithoutCorrelationToEmpty.json @@ -0,0 +1,132 @@ +{ + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[=($cor0.EMPNO, null)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalValues(tuples=[[]])\n" ], + "schemas" : [ { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR" ], + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + } ], + "queries" : [ { + "project" : { + "source" : { + "project" : { + "source" : { + "correlate" : { + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "function" : [ ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 1 + } + } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] + } + } + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + }, { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testCustomColumnResolvingInCorrelatedSubQuery.json b/tests/calcite/testCustomColumnResolvingInCorrelatedSubQuery.json index b497057..dfecb12 100644 --- a/tests/calcite/testCustomColumnResolvingInCorrelatedSubQuery.json +++ b/tests/calcite/testCustomColumnResolvingInCorrelatedSubQuery.json @@ -1,147 +1,75 @@ { + "help" : [ "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[=($4, $SCALAR_QUERY({\nLogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(\"F1\".\"C0\"=[$5])\n LogicalFilter(condition=[=($cor0.\"K0\", $0)])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n", "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[=($4, $9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{0}])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n LogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(\"F1\".\"C0\"=[$5])\n LogicalFilter(condition=[=($cor0.\"K0\", $0)])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n" ], "schemas" : [ { - "name" : "T", - "fields" : [ "\"K0\"", "\"C1\"", "\"F1\".\"A0\"", "\"F2\".\"A0\"", "\"F0\".\"C0\"", "\"F1\".\"C0\"", "\"F0\".\"C1\"", "\"F1\".\"C2\"", "\"F2\".\"C3\"" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "BOOLEAN", "INTEGER", "INTEGER", "INTEGER", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false, false, true, false, false, false ], + "name" : "CATALOG.STRUCT.T", + "guaranteed" : [ ], + "fields" : [ "\"K0\"", "\"C1\"", "\"F1\".\"A0\"", "\"F2\".\"A0\"", "\"F0\".\"C0\"", "\"F1\".\"C0\"", "\"F0\".\"C1\"", "\"F1\".\"C2\"", "\"F2\".\"C3\"" ], + "key" : [ ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "BOOLEAN" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 4, "type" : "INTEGER" }, { - "operator" : "$SCALAR_QUERY", - "operand" : [ ], "query" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 14, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "operator" : "=" }, "source" : { - "project" : { - "target" : [ { - "column" : 14, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 14, + "type" : "INTEGER" + } ] } - } ] + } } }, - "type" : "INTEGER" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "$SCALAR_QUERY" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -169,9 +97,76 @@ }, { "column" : 8, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "source" : { + "correlate" : { + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 14, + "type" : "INTEGER" + } ] + } + } + } + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -199,112 +194,37 @@ }, { "column" : 8, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "correlate" : [ { - "scan" : 0 - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 14, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 14, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - } ] - } - } - } + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BOOLEAN" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[=($4, $SCALAR_QUERY({\nLogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(\"F1\".\"C0\"=[$5])\n LogicalFilter(condition=[=($cor0.\"K0\", $0)])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n", "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[=($4, $9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{0}])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n LogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(\"F1\".\"C0\"=[$5])\n LogicalFilter(condition=[=($cor0.\"K0\", $0)])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testCustomColumnResolvingInCorrelatedSubQuery2.json b/tests/calcite/testCustomColumnResolvingInCorrelatedSubQuery2.json index 446b909..b12b5e7 100644 --- a/tests/calcite/testCustomColumnResolvingInCorrelatedSubQuery2.json +++ b/tests/calcite/testCustomColumnResolvingInCorrelatedSubQuery2.json @@ -1,60 +1,24 @@ { + "help" : [ "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[IN($4, {\nLogicalProject(C0=[$5])\n LogicalFilter(condition=[=($cor0.\"F1\".\"C2\", $7)])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n", "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[=($4, $9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n LogicalAggregate(group=[{0}])\n LogicalProject(C0=[$5])\n LogicalFilter(condition=[=($cor0.\"F1\".\"C2\", $7)])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n" ], "schemas" : [ { - "name" : "T", - "fields" : [ "\"K0\"", "\"C1\"", "\"F1\".\"A0\"", "\"F2\".\"A0\"", "\"F0\".\"C0\"", "\"F1\".\"C0\"", "\"F0\".\"C1\"", "\"F1\".\"C2\"", "\"F2\".\"C3\"" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "BOOLEAN", "INTEGER", "INTEGER", "INTEGER", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false, false, true, false, false, false ], + "name" : "CATALOG.STRUCT.T", + "guaranteed" : [ ], + "fields" : [ "\"K0\"", "\"C1\"", "\"F1\".\"A0\"", "\"F2\".\"A0\"", "\"F0\".\"C0\"", "\"F1\".\"C0\"", "\"F0\".\"C1\"", "\"F1\".\"C2\"", "\"F2\".\"C3\"" ], + "key" : [ ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "BOOLEAN" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "IN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], "query" : { "project" : { - "target" : [ { - "column" : 14, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -62,25 +26,31 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 14, + "type" : "INTEGER" + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "IN" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -108,9 +78,70 @@ }, { "column" : 8, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "source" : { + "correlate" : { + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 14, + "type" : "INTEGER" + } ] + } + } + } + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -138,116 +169,37 @@ }, { "column" : 8, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "correlate" : [ { - "scan" : 0 - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 14, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 15, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - } ] - } - } - } + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BOOLEAN" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[IN($4, {\nLogicalProject(C0=[$5])\n LogicalFilter(condition=[=($cor0.\"F1\".\"C2\", $7)])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n", "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[=($4, $9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n LogicalAggregate(group=[{0}])\n LogicalProject(C0=[$5])\n LogicalFilter(condition=[=($cor0.\"F1\".\"C2\", $7)])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testCustomColumnResolvingInNonCorrelatedSubQuery.json b/tests/calcite/testCustomColumnResolvingInNonCorrelatedSubQuery.json index 9e24a8f..9882e3f 100644 --- a/tests/calcite/testCustomColumnResolvingInNonCorrelatedSubQuery.json +++ b/tests/calcite/testCustomColumnResolvingInNonCorrelatedSubQuery.json @@ -1,71 +1,41 @@ { + "help" : [ "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[IN($4, {\nLogicalProject(C0=[$5])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n})])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n", "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalJoin(condition=[=($4, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n LogicalAggregate(group=[{0}])\n LogicalProject(C0=[$5])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n" ], "schemas" : [ { - "name" : "T", - "fields" : [ "\"K0\"", "\"C1\"", "\"F1\".\"A0\"", "\"F2\".\"A0\"", "\"F0\".\"C0\"", "\"F1\".\"C0\"", "\"F0\".\"C1\"", "\"F1\".\"C2\"", "\"F2\".\"C3\"" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "BOOLEAN", "INTEGER", "INTEGER", "INTEGER", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false, false, true, false, false, false ], + "name" : "CATALOG.STRUCT.T", + "guaranteed" : [ ], + "fields" : [ "\"K0\"", "\"C1\"", "\"F1\".\"A0\"", "\"F2\".\"A0\"", "\"F0\".\"C0\"", "\"F1\".\"C0\"", "\"F0\".\"C1\"", "\"F1\".\"C2\"", "\"F2\".\"C3\"" ], + "key" : [ ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "BOOLEAN" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "IN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], "query" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 14, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "IN" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -93,9 +63,51 @@ }, { "column" : 8, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ] + } + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -123,86 +135,37 @@ }, { "column" : 8, "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BOOLEAN" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalFilter(condition=[IN($4, {\nLogicalProject(C0=[$5])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n})])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n", "LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalProject(\"K0\"=[$0], \"C1\"=[$1], \"F1\".\"A0\"=[$2], \"F2\".\"A0\"=[$3], \"F0\".\"C0\"=[$4], \"F1\".\"C0\"=[$5], \"F0\".\"C1\"=[$6], \"F1\".\"C2\"=[$7], \"F2\".\"C3\"=[$8])\n LogicalJoin(condition=[=($4, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n LogicalAggregate(group=[{0}])\n LogicalProject(C0=[$5])\n LogicalTableScan(table=[[CATALOG, STRUCT, T]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDecorrelateAggWithConstantGroupKey.json b/tests/calcite/testDecorrelateAggWithConstantGroupKey.json index 5853ba3..b8edf1e 100644 --- a/tests/calcite/testDecorrelateAggWithConstantGroupKey.json +++ b/tests/calcite/testDecorrelateAggWithConstantGroupKey.json @@ -1,417 +1,123 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{3, 5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($cor0.SAL, $0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(EXPR$0=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$0=[MAX($2)])\n LogicalProject(DEPTNO=[$2], $f1=['abc'], SAL=[$1])\n LogicalFilter(condition=[=($cor0.MGR, $0)])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[AND(=($3, $10), =($5, $9))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[$2], EMPNO=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$0=[MAX($2)])\n LogicalProject(DEPTNO=[$7], EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { - "correlate" : [ { - "scan" : 0 - }, { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "CHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "operator" : "_ISO-8859-1'abc'", - "operand" : [ ], - "type" : "CHAR" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 13, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "CHAR" - }, { - "column" : 12, - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 13, - "type" : "INTEGER" - }, { - "operator" : "_ISO-8859-1'abc'", - "operand" : [ ], - "type" : "CHAR" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 18, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } - } - } ] - } - } - } - } - } + "correlate" : { + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "source" : { + "group" : { + "keys" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "CHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, + "column" : 11, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "MAX", + "ignoreNulls" : false } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 12, - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 10, + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, "type" : "INTEGER" }, { - "column" : 11, - "type" : "CHAR" + "column" : 9, + "type" : "INTEGER" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 12, - "type" : "INTEGER" - }, { - "operator" : "_ISO-8859-1'abc'", - "operand" : [ ], - "type" : "CHAR" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { + "operator" : "=" + }, + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { "column" : 14, "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 11, - "type" : "CHAR" - }, { - "column" : 13, - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 14, - "type" : "INTEGER" - }, { - "operator" : "_ISO-8859-1'abc'", - "operand" : [ ], - "type" : "CHAR" - }, { - "column" : 13, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "INTEGER" - }, { - "column" : 19, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } + }, { + "column" : 16, + "type" : "INTEGER" + } ] } } - } ] - } + } + }, + "target" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'abc'" + }, { + "column" : 10, + "type" : "INTEGER" + } ] } } } - } + }, + "target" : [ { + "column" : 11, + "type" : "INTEGER" + } ] } } - } ] + } } } } - } ] - } - } - }, { - "project" : { + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -439,14 +145,16 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" @@ -454,9 +162,9 @@ "column" : 10, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" @@ -464,118 +172,93 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" }, { - "column" : 1, + "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + }, { + "column" : 5, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{3, 5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($cor0.SAL, $0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(EXPR$0=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$0=[MAX($2)])\n LogicalProject(DEPTNO=[$2], $f1=['abc'], SAL=[$1])\n LogicalFilter(condition=[=($cor0.MGR, $0)])\n LogicalProject(EMPNO=[$0], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[AND(=($3, $10), =($5, $9))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[$2], EMPNO=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$0=[MAX($2)])\n LogicalProject(DEPTNO=[$7], EMPNO=[$0], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDecorrelateExists.json b/tests/calcite/testDecorrelateExists.json index f9b8cb0..4f96905 100644 --- a/tests/calcite/testDecorrelateExists.json +++ b/tests/calcite/testDecorrelateExists.json @@ -1,51 +1,22 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[EXISTS({\nLogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], $f1=[true])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "EXISTS", - "operand" : [ ], "query" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -53,23 +24,22 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "EXISTS" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -97,12 +67,14 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -110,83 +82,74 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + } ] } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[EXISTS({\nLogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], $f1=[true])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDecorrelateTwoExists.json b/tests/calcite/testDecorrelateTwoExists.json index 78bba5f..716673c 100644 --- a/tests/calcite/testDecorrelateTwoExists.json +++ b/tests/calcite/testDecorrelateTwoExists.json @@ -1,53 +1,24 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(EXISTS({\nLogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), NOT(EXISTS({\nLogicalFilter(condition=[AND(=($2, $cor0.JOB), =($5, 34))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NULL($12)])\n LogicalJoin(condition=[=($2, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], $f1=[true])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$0], $f1=[true])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$2])\n LogicalFilter(condition=[=($5, 34)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "EXISTS", - "operand" : [ ], "query" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -55,25 +26,25 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "EXISTS" }, { - "operator" : "NOT", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "EXISTS", - "operand" : [ ], "query" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 11, "type" : "VARCHAR" @@ -81,40 +52,39 @@ "column" : 2, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 14, "type" : "INTEGER" }, { - "operator" : "34", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "34" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "EXISTS" } ], - "type" : "BOOLEAN" + "operator" : "NOT" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -142,22 +112,24 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 12, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "VARCHAR" @@ -165,13 +137,12 @@ "column" : 11, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -179,188 +150,127 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + } ] } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] } } } }, + "kind" : "LEFT", "right" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "34", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "34" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "34", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] } } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(EXISTS({\nLogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), NOT(EXISTS({\nLogicalFilter(condition=[AND(=($2, $cor0.JOB), =($5, 34))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NULL($12)])\n LogicalJoin(condition=[=($2, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], $f1=[true])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$0], $f1=[true])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$2])\n LogicalFilter(condition=[=($5, 34)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDecorrelateTwoIn.json b/tests/calcite/testDecorrelateTwoIn.json index 6190086..799b23b 100644 --- a/tests/calcite/testDecorrelateTwoIn.json +++ b/tests/calcite/testDecorrelateTwoIn.json @@ -1,45 +1,33 @@ { + "help" : [ "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[AND(IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n}), IN($0, {\nLogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=($cor0.ENAME, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalJoin(condition=[AND(=($1, $12), =($0, $11))], joinType=[inner])\n LogicalJoin(condition=[AND(=($2, $10), =($0, $9))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], - "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] - }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IN", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "query" : { "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "VARCHAR" @@ -47,32 +35,32 @@ "column" : 10, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "scan" : 1 + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ] } }, - "type" : "BOOLEAN" - }, { - "operator" : "IN", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" } ], + "operator" : "IN" + }, { "query" : { "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -80,38 +68,46 @@ "column" : 10, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "scan" : 0 + "scan" : 1 } } - } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "IN" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { - "scan" : 0 + "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 5, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -119,9 +115,9 @@ "column" : 12, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -129,17 +125,16 @@ "column" : 11, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "VARCHAR" @@ -147,9 +142,9 @@ "column" : 10, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -157,46 +152,51 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { - "scan" : 0 + "scan" : 1 }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } + } ] } } } }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } } } - } + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[AND(IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n}), IN($0, {\nLogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=($cor0.ENAME, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalJoin(condition=[AND(=($1, $12), =($0, $11))], joinType=[inner])\n LogicalJoin(condition=[AND(=($2, $10), =($0, $9))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDecorrelateUncorrelatedInAndCorrelatedExists.json b/tests/calcite/testDecorrelateUncorrelatedInAndCorrelatedExists.json index 00bca7e..0057bb3 100644 --- a/tests/calcite/testDecorrelateUncorrelatedInAndCorrelatedExists.json +++ b/tests/calcite/testDecorrelateUncorrelatedInAndCorrelatedExists.json @@ -1,87 +1,58 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(IN($2, {\nLogicalProject(JOB=[$2])\n LogicalFilter(condition=[=($5, 34)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), EXISTS({\nLogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $10)], joinType=[inner])\n LogicalJoin(condition=[=($2, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$2])\n LogicalFilter(condition=[=($5, 34)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], $f1=[true])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IN", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], "query" : { "project" : { - "target" : [ { - "column" : 11, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 14, "type" : "INTEGER" }, { - "operator" : "34", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "34" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 11, + "type" : "VARCHAR" + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "IN" }, { - "operator" : "EXISTS", - "operand" : [ ], "query" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -89,25 +60,24 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "EXISTS" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -135,12 +105,14 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -148,13 +120,12 @@ "column" : 10, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "VARCHAR" @@ -162,174 +133,113 @@ "column" : 9, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "34", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "34" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "34", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + } ] } - } ] + } } } } }, + "kind" : "INNER", "right" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(IN($2, {\nLogicalProject(JOB=[$2])\n LogicalFilter(condition=[=($5, 34)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), EXISTS({\nLogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $10)], joinType=[inner])\n LogicalJoin(condition=[=($2, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(JOB=[$2])\n LogicalFilter(condition=[=($5, 34)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], $f1=[true])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDigestOfApproximateDistinctAggregateCall.json b/tests/calcite/testDigestOfApproximateDistinctAggregateCall.json index eb01a19..2fc4214 100644 --- a/tests/calcite/testDigestOfApproximateDistinctAggregateCall.json +++ b/tests/calcite/testDigestOfApproximateDistinctAggregateCall.json @@ -1,278 +1,140 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], EXPR$1=[$1])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT(APPROXIMATE DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$1])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{7}], EXPR$1=[COUNT(DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{7}], EXPR$1=[COUNT(APPROXIMATE DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "BIGINT" - } ], "source" : { "union" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + } ] } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] + } } }, { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + } ] } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] + } } } ] - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "BIGINT" - } ], + } ] + } + }, { + "project" : { "source" : { "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] + "group" : { + "keys" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "scan" : 0 + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] + "group" : { + "keys" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "scan" : 0 + } } } ] - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BIGINT" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], EXPR$1=[$1])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT(APPROXIMATE DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$1])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{7}], EXPR$1=[COUNT(DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{7}], EXPR$1=[COUNT(APPROXIMATE DISTINCT $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctCount1.json b/tests/calcite/testDistinctCount1.json index 24c25a2..8ae8849 100644 --- a/tests/calcite/testDistinctCount1.json +++ b/tests/calcite/testDistinctCount1.json @@ -1,234 +1,75 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{1}], EXPR$1=[COUNT($0)])\n LogicalAggregate(group=[{1, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + }, { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, "type" : "INTEGER" } ], + "function" : [ ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } + "scan" : 0 } } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{1}], EXPR$1=[COUNT($0)])\n LogicalAggregate(group=[{1, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctCount2.json b/tests/calcite/testDistinctCount2.json index 24491ed..73bb38f 100644 --- a/tests/calcite/testDistinctCount2.json +++ b/tests/calcite/testDistinctCount2.json @@ -1,424 +1,188 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1) FILTER $3], EXPR$2=[MIN($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], ENAME=[$1], EXPR$2=[$2], $g_0=[=($3, 0)], $g_1=[=($3, 1)])\n LogicalProject(DEPTNO=[$1], ENAME=[$0], EXPR$2=[$2], $g=[$3])\n LogicalAggregate(group=[{1, 7}], groups=[[{1, 7}, {7}]], EXPR$2=[SUM($5)], $g=[GROUPING($7, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "COUNT", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 2, + "column" : 1, "type" : "VARCHAR" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "COUNT", + "ignoreNulls" : false }, { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 3, + "column" : 2, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "MIN", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "BIGINT" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], "source" : { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { "column" : 1, - "type" : "INTEGER" - }, { - "column" : 0, "type" : "VARCHAR" }, { - "column" : 2, + "column" : 7, "type" : "INTEGER" - }, { - "column" : 3, - "type" : "BIGINT" } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "operator" : "=", + "function" : [ { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], + "column" : 5, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "SUM", + "ignoreNulls" : false }, { - "operator" : "=", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], + "column" : 7, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "GROUPING", + "ignoreNulls" : false } ], "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "BIGINT" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "=" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1) FILTER $3], EXPR$2=[MIN($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], ENAME=[$1], EXPR$2=[$2], $g_0=[=($3, 0)], $g_1=[=($3, 1)])\n LogicalProject(DEPTNO=[$1], ENAME=[$0], EXPR$2=[$2], $g=[$3])\n LogicalAggregate(group=[{1, 7}], groups=[[{1, 7}, {7}]], EXPR$2=[SUM($5)], $g=[GROUPING($7, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctCount3.json b/tests/calcite/testDistinctCount3.json index c3e9dfc..530eb81 100644 --- a/tests/calcite/testDistinctCount3.json +++ b/tests/calcite/testDistinctCount3.json @@ -1,114 +1,158 @@ { + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$2])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT(DISTINCT $0)], EXPR$1=[SUM($1)])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$2])\n LogicalProject(DEPTNO=[$0], EXPR$0=[$1], EXPR$1=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT($0) FILTER $2], EXPR$1=[MIN($1) FILTER $2])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $g_0=[=($2, 0)])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], $g=[GROUPING($0)])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ] + } + } + } + }, "target" : [ { "column" : 1, "type" : "BIGINT" }, { "column" : 2, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "COUNT", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 1, + "column" : 0, "type" : "INTEGER" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "COUNT", + "ignoreNulls" : false }, { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 2, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "MIN", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false }, { - "column" : 6, - "type" : "INTEGER" + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "GROUPING", + "ignoreNulls" : false } ], "source" : { - "scan" : 0 + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ] + } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + } ] } } } - } ] - } - } - } - }, { - "project" : { - "target" : [ { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -116,275 +160,22 @@ "column" : 1, "type" : "BIGINT" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } - } - } ] - } - } + "operator" : "CAST" + } ] } - } + }, + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$2])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT(DISTINCT $0)], EXPR$1=[SUM($1)])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$2])\n LogicalProject(DEPTNO=[$0], EXPR$0=[$1], EXPR$1=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT($0) FILTER $2], EXPR$1=[MIN($1) FILTER $2])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $g_0=[=($2, 0)])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], $g=[GROUPING($0)])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctCountGroupingSets1.json b/tests/calcite/testDistinctCountGroupingSets1.json index c9556ac..4387182 100644 --- a/tests/calcite/testDistinctCountGroupingSets1.json +++ b/tests/calcite/testDistinctCountGroupingSets1.json @@ -1,428 +1,141 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT(DISTINCT $2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT($2) FILTER $3])\n LogicalProject(DEPTNO=[$0], JOB=[$1], ENAME=[$2], $g_0=[=($3, 0)])\n LogicalAggregate(group=[{0, 1, 2}], $g=[GROUPING($0, $1, $2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" }, { "column" : 1, "type" : "VARCHAR" - } ], + } ] + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { - "project" : { - "target" : [ { - "column" : 7, + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" }, { - "column" : 2, + "column" : 1, "type" : "VARCHAR" }, { - "column" : 1, + "column" : 2, "type" : "VARCHAR" } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", + "function" : [ { + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" - }, + "operator" : "GROUPING", + "ignoreNulls" : false + } ], "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 9, + "column" : 7, "type" : "INTEGER" }, { - "column" : 4, + "column" : 2, "type" : "VARCHAR" }, { - "column" : 3, + "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } } } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "GROUPING", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "type" : "BOOLEAN", "operand" : [ { - "column" : 4, - "type" : "VARCHAR" + "column" : 3, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "GROUPING", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } + "operator" : "=" + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT(DISTINCT $2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT($2) FILTER $3])\n LogicalProject(DEPTNO=[$0], JOB=[$1], ENAME=[$2], $g_0=[=($3, 0)])\n LogicalAggregate(group=[{0, 1, 2}], $g=[GROUPING($0, $1, $2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctCountGroupingSets2.json b/tests/calcite/testDistinctCountGroupingSets2.json index e0b30c4..5b02c62 100644 --- a/tests/calcite/testDistinctCountGroupingSets2.json +++ b/tests/calcite/testDistinctCountGroupingSets2.json @@ -1,150 +1,97 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT(DISTINCT $2)], EXPR$3=[SUM($3)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], JOB=[$1], EXPR$2=[$2], EXPR$3=[CAST($3):INTEGER NOT NULL])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT($2) FILTER $4], EXPR$3=[MIN($3) FILTER $5])\n LogicalProject(DEPTNO=[$0], JOB=[$1], ENAME=[$2], EXPR$3=[$3], $g_0=[=($4, 0)], $g_1=[=($4, 1)])\n LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1, 2}, {0, 1}]], EXPR$3=[SUM($3)], $g=[GROUPING($0, $1, $2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "COUNT", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 4, + "column" : 2, "type" : "VARCHAR" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "COUNT", + "ignoreNulls" : false }, { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 5, + "column" : 3, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "MIN", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" }, { @@ -153,379 +100,110 @@ }, { "column" : 2, "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "operator" : "=", + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], + "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "SUM", + "ignoreNulls" : false }, { - "operator" : "=", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], + "column" : 0, "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" - }, + "operator" : "GROUPING", + "ignoreNulls" : false + } ], "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 2, + "column" : 7, "type" : "INTEGER" }, { - "column" : 3, + "column" : 2, "type" : "VARCHAR" }, { - "column" : 4, + "column" : 1, "type" : "VARCHAR" }, { "column" : 5, "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "=" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT(DISTINCT $2)], EXPR$3=[SUM($3)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], JOB=[$1], EXPR$2=[$2], EXPR$3=[CAST($3):INTEGER NOT NULL])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT($2) FILTER $4], EXPR$3=[MIN($3) FILTER $5])\n LogicalProject(DEPTNO=[$0], JOB=[$1], ENAME=[$2], EXPR$3=[$3], $g_0=[=($4, 0)], $g_1=[=($4, 1)])\n LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1, 2}, {0, 1}]], EXPR$3=[SUM($3)], $g=[GROUPING($0, $1, $2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], ENAME=[$1], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctCountMixed.json b/tests/calcite/testDistinctCountMixed.json index 2c8d3b5..2aa7b46 100644 --- a/tests/calcite/testDistinctCountMixed.json +++ b/tests/calcite/testDistinctCountMixed.json @@ -1,452 +1,191 @@ { + "help" : [ "LogicalAggregate(group=[{0}], CDDJ=[COUNT(DISTINCT $0, $1)], S=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], CDDJ=[$1], S=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], CDDJ=[COUNT($0, $1) FILTER $3], S=[MIN($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], JOB=[$1], S=[$2], $g_0=[=($3, 0)], $g_1=[=($3, 1)])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]], S=[SUM($2)], $g=[GROUPING($0, $1)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "COUNT", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 1, + "column" : 0, "type" : "INTEGER" }, { - "column" : 2, + "column" : 1, "type" : "VARCHAR" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "COUNT", + "ignoreNulls" : false }, { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 3, + "column" : 2, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "MIN", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "BIGINT" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "=", + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 3, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], + "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "SUM", + "ignoreNulls" : false }, { - "operator" : "=", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 3, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], + "column" : 0, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "GROUPING", + "ignoreNulls" : false } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 5, + "type" : "INTEGER" } ] } } } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", "operand" : [ { - "column" : 1, - "type" : "INTEGER" + "column" : 3, + "type" : "BIGINT" }, { - "column" : 2, - "type" : "VARCHAR" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "=" }, { - "operator" : "MIN", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, - "type" : "INTEGER" + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } + "operator" : "=" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], CDDJ=[COUNT(DISTINCT $0, $1)], S=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], CDDJ=[$1], S=[CAST($2):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], CDDJ=[COUNT($0, $1) FILTER $3], S=[MIN($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], JOB=[$1], S=[$2], $g_0=[=($3, 0)], $g_1=[=($3, 1)])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]], S=[SUM($2)], $g=[GROUPING($0, $1)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctCountMixed2.json b/tests/calcite/testDistinctCountMixed2.json index 1c42764..fc1dada 100644 --- a/tests/calcite/testDistinctCountMixed2.json +++ b/tests/calcite/testDistinctCountMixed2.json @@ -1,532 +1,259 @@ { + "help" : [ "LogicalAggregate(group=[{0}], CDE=[COUNT(DISTINCT $1)], CDJE=[COUNT(DISTINCT $2, $1)], CDDJ=[COUNT(DISTINCT $0, $2)], S=[SUM($3)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], CDE=[$1], CDJE=[$2], CDDJ=[$3], S=[CAST($4):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], CDE=[COUNT($1) FILTER $5], CDJE=[COUNT($2, $1) FILTER $4], CDDJ=[COUNT($0, $2) FILTER $6], S=[MIN($3) FILTER $7])\n LogicalProject(DEPTNO=[$2], ENAME=[$0], JOB=[$1], S=[$3], $g_0=[=($4, 0)], $g_1=[=($4, 1)], $g_2=[=($4, 2)], $g_3=[=($4, 3)])\n LogicalAggregate(group=[{1, 2, 7}], groups=[[{1, 2, 7}, {1, 7}, {2, 7}, {7}]], S=[SUM($5)], $g=[GROUPING($7, $1, $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "COUNT", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 2, + "column" : 1, "type" : "VARCHAR" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 3, + "column" : 2, "type" : "VARCHAR" }, { - "column" : 2, + "column" : 1, "type" : "VARCHAR" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 1, + "column" : 0, "type" : "INTEGER" }, { - "column" : 3, + "column" : 2, "type" : "VARCHAR" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "COUNT", + "ignoreNulls" : false }, { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 4, + "column" : 3, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "MIN", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 2, - "type" : "BIGINT" - }, { - "column" : 3, - "type" : "BIGINT" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 0, + "group" : { + "keys" : [ { + "column" : 1, "type" : "VARCHAR" }, { - "column" : 1, + "column" : 2, "type" : "VARCHAR" }, { - "column" : 3, + "column" : 7, "type" : "INTEGER" - }, { - "operator" : "=", + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], + "column" : 5, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "SUM", + "ignoreNulls" : false }, { - "operator" : "=", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], + "column" : 7, "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "BIGINT" }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "BIGINT" + "column" : 1, + "type" : "VARCHAR" }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" + "column" : 2, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "GROUPING", + "ignoreNulls" : false } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } + "scan" : 0 } } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", + }, + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", "operand" : [ { - "column" : 2, - "type" : "VARCHAR" + "column" : 4, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "=" }, { - "operator" : "COUNT", + "type" : "BOOLEAN", "operand" : [ { - "column" : 3, - "type" : "VARCHAR" + "column" : 4, + "type" : "BIGINT" }, { - "column" : 2, - "type" : "VARCHAR" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "=" }, { - "operator" : "COUNT", + "type" : "BOOLEAN", "operand" : [ { - "column" : 1, - "type" : "INTEGER" + "column" : 4, + "type" : "BIGINT" }, { - "column" : 3, - "type" : "VARCHAR" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "=" }, { - "operator" : "MIN", + "type" : "BOOLEAN", "operand" : [ { "column" : 4, - "type" : "INTEGER" + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "3" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - } + "operator" : "=" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 3, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], CDE=[COUNT(DISTINCT $1)], CDJE=[COUNT(DISTINCT $2, $1)], CDDJ=[COUNT(DISTINCT $0, $2)], S=[SUM($3)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], CDE=[$1], CDJE=[$2], CDDJ=[$3], S=[CAST($4):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], CDE=[COUNT($1) FILTER $5], CDJE=[COUNT($2, $1) FILTER $4], CDDJ=[COUNT($0, $2) FILTER $6], S=[MIN($3) FILTER $7])\n LogicalProject(DEPTNO=[$2], ENAME=[$0], JOB=[$1], S=[$3], $g_0=[=($4, 0)], $g_1=[=($4, 1)], $g_2=[=($4, 2)], $g_3=[=($4, 3)])\n LogicalAggregate(group=[{1, 2, 7}], groups=[[{1, 2, 7}, {1, 7}, {2, 7}, {7}]], S=[SUM($5)], $g=[GROUPING($7, $1, $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctCountMixedJoin.json b/tests/calcite/testDistinctCountMixedJoin.json index 2ec708e..608b607 100644 --- a/tests/calcite/testDistinctCountMixedJoin.json +++ b/tests/calcite/testDistinctCountMixedJoin.json @@ -1,151 +1,89 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[COUNT(DISTINCT $2, $1)], EXPR$3=[COUNT(DISTINCT $0, $2)], EXPR$4=[SUM($3)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$3], EXPR$2=[$5], EXPR$3=[$7], EXPR$4=[$1])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $6)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{7}], EXPR$4=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$1=[COUNT($0)])\n LogicalAggregate(group=[{1, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{2}], EXPR$2=[COUNT($1, $0)])\n LogicalAggregate(group=[{1, 2, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$3=[COUNT($1, $0)])\n LogicalAggregate(group=[{2, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" + "column" : 1, + "type" : "VARCHAR" }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" + "column" : 2, + "type" : "VARCHAR" }, { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "column" : 5, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } }, { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "BIGINT" - }, { - "column" : 5, - "type" : "BIGINT" - }, { - "column" : 7, - "type" : "BIGINT" - }, { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "IS NOT DISTINCT FROM", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -153,13 +91,12 @@ "column" : 6, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT DISTINCT FROM" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "IS NOT DISTINCT FROM", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -167,13 +104,12 @@ "column" : 4, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT DISTINCT FROM" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "IS NOT DISTINCT FROM", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -181,553 +117,162 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT DISTINCT FROM" }, "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - } ] - } - } - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, + "group" : { + "keys" : [ { + "column" : 7, "type" : "INTEGER" } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } + "scan" : 0 } } - }, { - "aggregate" : { + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "INTEGER" + } ], "function" : [ { - "operator" : "COUNT", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, + "column" : 0, "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - } ] - } - } - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, + "group" : { + "keys" : [ { + "column" : 1, "type" : "VARCHAR" }, { "column" : 7, "type" : "INTEGER" } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { "function" : [ ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } + "scan" : 0 } } - } ] + } } } } - }, { - "aggregate" : { + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "INTEGER" + } ], "function" : [ { - "operator" : "COUNT", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { "column" : 1, "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } + "scan" : 0 } } } } - } ] + } + } + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "scan" : 0 + } + } + } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + }, { + "column" : 5, + "type" : "BIGINT" + }, { + "column" : 7, + "type" : "BIGINT" + }, { + "column" : 1, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[COUNT(DISTINCT $2, $1)], EXPR$3=[COUNT(DISTINCT $0, $2)], EXPR$4=[SUM($3)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$3], EXPR$2=[$5], EXPR$3=[$7], EXPR$4=[$1])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $6)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{7}], EXPR$4=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$1=[COUNT($0)])\n LogicalAggregate(group=[{1, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{2}], EXPR$2=[COUNT($1, $0)])\n LogicalAggregate(group=[{1, 2, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$3=[COUNT($1, $0)])\n LogicalAggregate(group=[{2, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctCountMultiple.json b/tests/calcite/testDistinctCountMultiple.json index a02796f..0239d8a 100644 --- a/tests/calcite/testDistinctCountMultiple.json +++ b/tests/calcite/testDistinctCountMultiple.json @@ -1,420 +1,167 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[COUNT(DISTINCT $2)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1) FILTER $3], EXPR$2=[COUNT($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], ENAME=[$1], JOB=[$2], $g_1=[=($3, 1)], $g_2=[=($3, 2)])\n LogicalProject(DEPTNO=[$2], ENAME=[$0], JOB=[$1], $g=[$3])\n LogicalAggregate(group=[{1, 2, 7}], groups=[[{1, 7}, {2, 7}]], $g=[GROUPING($7, $1, $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ] } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" }, { "column" : 2, "type" : "VARCHAR" }, { - "column" : 3, - "type" : "VARCHAR" + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "GROUPING", + "ignoreNulls" : false } ], "source" : { "scan" : 0 } } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { + }, "target" : [ { - "column" : 0, + "column" : 2, "type" : "INTEGER" }, { - "column" : 1, + "column" : 0, "type" : "VARCHAR" }, { - "column" : 2, + "column" : 1, "type" : "VARCHAR" }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "BIGINT" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "BIGINT" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "GROUPING", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } + "column" : 3, + "type" : "BIGINT" + } ] } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "type" : "BOOLEAN", "operand" : [ { - "column" : 2, - "type" : "VARCHAR" + "column" : 3, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "=" }, { - "operator" : "COUNT", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, - "type" : "VARCHAR" + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "BIGINT" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "GROUPING", - "operand" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - } - } - } + "operator" : "=" + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[COUNT(DISTINCT $2)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1) FILTER $3], EXPR$2=[COUNT($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], ENAME=[$1], JOB=[$2], $g_1=[=($3, 1)], $g_2=[=($3, 2)])\n LogicalProject(DEPTNO=[$2], ENAME=[$0], JOB=[$1], $g=[$3])\n LogicalAggregate(group=[{1, 2, 7}], groups=[[{1, 7}, {2, 7}]], $g=[GROUPING($7, $1, $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctCountMultipleNoGroup.json b/tests/calcite/testDistinctCountMultipleNoGroup.json index bc52b7b..15a8942 100644 --- a/tests/calcite/testDistinctCountMultipleNoGroup.json +++ b/tests/calcite/testDistinctCountMultipleNoGroup.json @@ -1,316 +1,132 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(ENAME=[$1], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT($0) FILTER $2], EXPR$1=[COUNT($1) FILTER $3])\n LogicalProject(ENAME=[$0], JOB=[$1], $g_1=[=($2, 1)], $g_2=[=($2, 2)])\n LogicalAggregate(group=[{1, 2}], groups=[[{1}, {2}]], $g=[GROUPING($1, $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "column" : 2, + "type" : "VARCHAR" + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { + "group" : { + "keys" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "=", + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 2, - "type" : "BIGINT" + "column" : 1, + "type" : "VARCHAR" }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "GROUPING", + "ignoreNulls" : false } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "GROUPING", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } + "scan" : 0 } } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "BOOLEAN", "operand" : [ { - "column" : 0, - "type" : "VARCHAR" + "column" : 2, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "=" }, { - "operator" : "COUNT", + "type" : "BOOLEAN", "operand" : [ { - "column" : 1, - "type" : "VARCHAR" + "column" : 2, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "GROUPING", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - } + "operator" : "=" + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(ENAME=[$1], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT($0) FILTER $2], EXPR$1=[COUNT($1) FILTER $3])\n LogicalProject(ENAME=[$0], JOB=[$1], $g_1=[=($2, 1)], $g_2=[=($2, 2)])\n LogicalAggregate(group=[{1, 2}], groups=[[{1}, {2}]], $g=[GROUPING($1, $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctCountMultipleViaJoin.json b/tests/calcite/testDistinctCountMultipleViaJoin.json index 2ec708e..608b607 100644 --- a/tests/calcite/testDistinctCountMultipleViaJoin.json +++ b/tests/calcite/testDistinctCountMultipleViaJoin.json @@ -1,151 +1,89 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[COUNT(DISTINCT $2, $1)], EXPR$3=[COUNT(DISTINCT $0, $2)], EXPR$4=[SUM($3)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$3], EXPR$2=[$5], EXPR$3=[$7], EXPR$4=[$1])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $6)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{7}], EXPR$4=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$1=[COUNT($0)])\n LogicalAggregate(group=[{1, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{2}], EXPR$2=[COUNT($1, $0)])\n LogicalAggregate(group=[{1, 2, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$3=[COUNT($1, $0)])\n LogicalAggregate(group=[{2, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" + "column" : 1, + "type" : "VARCHAR" }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" + "column" : 2, + "type" : "VARCHAR" }, { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "column" : 5, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } }, { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "BIGINT" - }, { - "column" : 5, - "type" : "BIGINT" - }, { - "column" : 7, - "type" : "BIGINT" - }, { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "IS NOT DISTINCT FROM", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -153,13 +91,12 @@ "column" : 6, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT DISTINCT FROM" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "IS NOT DISTINCT FROM", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -167,13 +104,12 @@ "column" : 4, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT DISTINCT FROM" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "IS NOT DISTINCT FROM", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -181,553 +117,162 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT DISTINCT FROM" }, "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - } ] - } - } - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, + "group" : { + "keys" : [ { + "column" : 7, "type" : "INTEGER" } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } + "scan" : 0 } } - }, { - "aggregate" : { + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "INTEGER" + } ], "function" : [ { - "operator" : "COUNT", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, + "column" : 0, "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - } ] - } - } - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, + "group" : { + "keys" : [ { + "column" : 1, "type" : "VARCHAR" }, { "column" : 7, "type" : "INTEGER" } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { "function" : [ ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } + "scan" : 0 } } - } ] + } } } } - }, { - "aggregate" : { + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "INTEGER" + } ], "function" : [ { - "operator" : "COUNT", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { "column" : 1, "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } + "scan" : 0 } } } } - } ] + } + } + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "scan" : 0 + } + } + } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + }, { + "column" : 5, + "type" : "BIGINT" + }, { + "column" : 7, + "type" : "BIGINT" + }, { + "column" : 1, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT(DISTINCT $1)], EXPR$2=[COUNT(DISTINCT $2, $1)], EXPR$3=[COUNT(DISTINCT $0, $2)], EXPR$4=[SUM($3)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1], JOB=[$2], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$3], EXPR$2=[$5], EXPR$3=[$7], EXPR$4=[$1])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $6)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{7}], EXPR$4=[SUM($5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$1=[COUNT($0)])\n LogicalAggregate(group=[{1, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{2}], EXPR$2=[COUNT($1, $0)])\n LogicalAggregate(group=[{1, 2, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$3=[COUNT($1, $0)])\n LogicalAggregate(group=[{2, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctCountWithExpandSumType.json b/tests/calcite/testDistinctCountWithExpandSumType.json index e2f56c2..0cb8ccc 100644 --- a/tests/calcite/testDistinctCountWithExpandSumType.json +++ b/tests/calcite/testDistinctCountWithExpandSumType.json @@ -1,250 +1,107 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()], EXPR$1=[COUNT(DISTINCT $0)])\n LogicalProject(COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[CAST($0):BIGINT NOT NULL], EXPR$1=[$1])\n LogicalAggregate(group=[{}], EXPR$0=[$SUM0($1)], EXPR$1=[COUNT($0)])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ] } - }, { - "aggregate" : { + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ ], "function" : [ { - "operator" : "COUNT", - "operand" : [ ], "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "type" : "DECIMAL", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false }, { - "operator" : "COUNT", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { "column" : 0, "type" : "INTEGER" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", "operand" : [ ], - "type" : "BOOLEAN" - }, + "operator" : "COUNT", + "ignoreNulls" : false + } ], "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 6, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } } } } - } ] - } - }, { - "project" : { + }, "target" : [ { - "operator" : "CAST", + "type" : "BIGINT", "operand" : [ { "column" : 0, "type" : "DECIMAL" } ], - "type" : "BIGINT" + "operator" : "CAST" }, { "column" : 1, "type" : "BIGINT" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 1, - "type" : "BIGINT" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "DECIMAL" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()], EXPR$1=[COUNT(DISTINCT $0)])\n LogicalProject(COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[CAST($0):BIGINT NOT NULL], EXPR$1=[$1])\n LogicalAggregate(group=[{}], EXPR$0=[$SUM0($1)], EXPR$1=[COUNT($0)])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctCountWithoutGroupBy.json b/tests/calcite/testDistinctCountWithoutGroupBy.json index 2d6ead9..5d277d6 100644 --- a/tests/calcite/testDistinctCountWithoutGroupBy.json +++ b/tests/calcite/testDistinctCountWithoutGroupBy.json @@ -1,302 +1,135 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[MAX($0)], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[MIN($1) FILTER $3], EXPR$1=[COUNT($0) FILTER $2])\n LogicalProject(ENAME=[$0], EXPR$0=[$1], $g_0=[=($2, 0)], $g_1=[=($2, 1)])\n LogicalAggregate(group=[{1}], groups=[[{1}, {}]], EXPR$0=[MAX($7)], $g=[GROUPING($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "column" : 7, "type" : "INTEGER" }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "column" : 1, + "type" : "VARCHAR" + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { + "group" : { + "keys" : [ { "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "=", + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], + "column" : 7, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "MAX", + "ignoreNulls" : false }, { - "operator" : "=", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" + "column" : 1, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "GROUPING", + "ignoreNulls" : false } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } + "scan" : 0 } } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", "operand" : [ { - "column" : 1, - "type" : "INTEGER" + "column" : 2, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "=" }, { - "operator" : "COUNT", + "type" : "BOOLEAN", "operand" : [ { - "column" : 0, - "type" : "VARCHAR" + "column" : 2, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - } + "operator" : "=" + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[MAX($0)], EXPR$1=[COUNT(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[MIN($1) FILTER $3], EXPR$1=[COUNT($0) FILTER $2])\n LogicalProject(ENAME=[$0], EXPR$0=[$1], $g_0=[=($2, 0)], $g_1=[=($2, 1)])\n LogicalAggregate(group=[{1}], groups=[[{1}, {}]], EXPR$0=[MAX($7)], $g=[GROUPING($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctNonDistinctAggregates.json b/tests/calcite/testDistinctNonDistinctAggregates.json index 77d3dc1..b688ea0 100644 --- a/tests/calcite/testDistinctNonDistinctAggregates.json +++ b/tests/calcite/testDistinctNonDistinctAggregates.json @@ -1,41 +1,123 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT()], EXPR$2=[AVG(DISTINCT $1)])\n LogicalProject(EMPNO=[$0], DEPTNO0=[$9])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($2)], EXPR$2=[AVG($1)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT()])\n LogicalProject(EMPNO=[$0], DEPTNO0=[$9])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "scan" : 1 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ] + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -43,384 +125,28 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "AVG", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } + "target" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - } - } + "column" : 9, + "type" : "INTEGER" } ] } } } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 3, - "type" : "BIGINT" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "AVG", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } ] - } - } - } - } - } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT()], EXPR$2=[AVG(DISTINCT $1)])\n LogicalProject(EMPNO=[$0], DEPTNO0=[$9])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($2)], EXPR$2=[AVG($1)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT()])\n LogicalProject(EMPNO=[$0], DEPTNO0=[$9])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctNonDistinctAggregatesWithGrouping1.json b/tests/calcite/testDistinctNonDistinctAggregatesWithGrouping1.json index 58e61f4..556b8e0 100644 --- a/tests/calcite/testDistinctNonDistinctAggregatesWithGrouping1.json +++ b/tests/calcite/testDistinctNonDistinctAggregatesWithGrouping1.json @@ -1,404 +1,173 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($0)], EXPR$2=[SUM(DISTINCT $1)], EXPR$3=[MAX($0)], EXPR$4=[MAX($2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($2)], EXPR$2=[SUM($1)], EXPR$3=[MAX($3)], EXPR$4=[MAX($4)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM($0)], EXPR$3=[MAX($0)], EXPR$4=[MAX($2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "column" : 7, "type" : "INTEGER" }, { - "operator" : "MAX", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "column" : 5, "type" : "INTEGER" }, { - "operator" : "MAX", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "column" : 6, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "SUM", + "type" : "INTEGER", "operand" : [ { - "column" : 2, + "column" : 0, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "SUM", + "ignoreNulls" : false }, { - "operator" : "MAX", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 4, + "column" : 0, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 5, + "column" : 2, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "MAX", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ] } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($0)], EXPR$2=[SUM(DISTINCT $1)], EXPR$3=[MAX($0)], EXPR$4=[MAX($2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($2)], EXPR$2=[SUM($1)], EXPR$3=[MAX($3)], EXPR$4=[MAX($4)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM($0)], EXPR$3=[MAX($0)], EXPR$4=[MAX($2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctNonDistinctAggregatesWithGrouping2.json b/tests/calcite/testDistinctNonDistinctAggregatesWithGrouping2.json index 5558e65..2dc1a39 100644 --- a/tests/calcite/testDistinctNonDistinctAggregatesWithGrouping2.json +++ b/tests/calcite/testDistinctNonDistinctAggregatesWithGrouping2.json @@ -1,305 +1,107 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT()], EXPR$2=[SUM(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($2)], EXPR$2=[SUM($1)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT()])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" }, { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, + "column" : 5, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 3, - "type" : "BIGINT" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ] } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT()], EXPR$2=[SUM(DISTINCT $1)])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($2)], EXPR$2=[SUM($1)])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[COUNT()])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctNonDistinctTwoAggregatesWithGrouping.json b/tests/calcite/testDistinctNonDistinctTwoAggregatesWithGrouping.json index 470f936..e2fd483 100644 --- a/tests/calcite/testDistinctNonDistinctTwoAggregatesWithGrouping.json +++ b/tests/calcite/testDistinctNonDistinctTwoAggregatesWithGrouping.json @@ -1,368 +1,146 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[SUM(DISTINCT $2)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($2)], EXPR$2=[MIN($3)], EXPR$3=[SUM($1)])\n LogicalAggregate(group=[{0, 2}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "column" : 7, "type" : "INTEGER" }, { - "operator" : "MIN", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "column" : 6, "type" : "INTEGER" }, { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, + "column" : 5, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", + "type" : "INTEGER", "operand" : [ { - "column" : 4, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 2, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "MIN", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ] } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[SUM(DISTINCT $2)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($2)], EXPR$2=[MIN($3)], EXPR$3=[SUM($1)])\n LogicalAggregate(group=[{0, 2}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctWithDiffFiltersAndSameGroupSet.json b/tests/calcite/testDistinctWithDiffFiltersAndSameGroupSet.json index 5c42b37..19ce8e4 100644 --- a/tests/calcite/testDistinctWithDiffFiltersAndSameGroupSet.json +++ b/tests/calcite/testDistinctWithDiffFiltersAndSameGroupSet.json @@ -1,484 +1,189 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT(DISTINCT $0) FILTER $1], EXPR$1=[COUNT(DISTINCT $1) FILTER $0])\n LogicalProject(C=[>($5, 1000)], D=[<($5, 500)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT($0) FILTER $3], EXPR$1=[COUNT($1) FILTER $2])\n LogicalProject(C=[$0], D=[$1], $g_0_f_0=[AND(=($2, 0), $0)], $g_0_f_1=[AND(=($2, 0), $1)])\n LogicalAggregate(group=[{0, 1}], $g=[GROUPING($0, $1)])\n LogicalProject(C=[>($5, 1000)], D=[<($5, 500)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "500", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", + "scan" : 0 + }, + "target" : [ { + "type" : "BOOLEAN", "operand" : [ { - "column" : 0, - "type" : "BOOLEAN" + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1000" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : ">" }, { - "operator" : "COUNT", + "type" : "BOOLEAN", "operand" : [ { - "column" : 1, - "type" : "BOOLEAN" + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "500" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "500", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "operator" : "<" + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { "column" : 0, "type" : "BOOLEAN" }, { "column" : 1, "type" : "BOOLEAN" - }, { - "operator" : "AND", + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { "column" : 0, "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" }, { "column" : 1, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "GROUPING", + "ignoreNulls" : false } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "BOOLEAN" - }, { - "column" : 1, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "500", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1000" + } ], + "operator" : ">" }, { - "aggregate" : { - "function" : [ { - "operator" : "GROUPING", - "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "BOOLEAN" - }, { - "column" : 2, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "<", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "500", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "500" + } ], + "operator" : "<" } ] } } } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", + }, + "target" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 1, + "type" : "BOOLEAN" + }, { + "type" : "BOOLEAN", "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { "column" : 0, "type" : "BOOLEAN" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "AND" }, { - "operator" : "COUNT", + "type" : "BOOLEAN", "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { "column" : 1, "type" : "BOOLEAN" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "BOOLEAN" - }, { - "column" : 1, - "type" : "BOOLEAN" - }, { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 0, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 1, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "BOOLEAN" - }, { - "column" : 1, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "500", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "GROUPING", - "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "BOOLEAN" - }, { - "column" : 2, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "<", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "500", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } + "operator" : "AND" + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT(DISTINCT $0) FILTER $1], EXPR$1=[COUNT(DISTINCT $1) FILTER $0])\n LogicalProject(C=[>($5, 1000)], D=[<($5, 500)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT($0) FILTER $3], EXPR$1=[COUNT($1) FILTER $2])\n LogicalProject(C=[$0], D=[$1], $g_0_f_0=[AND(=($2, 0), $0)], $g_0_f_1=[AND(=($2, 0), $1)])\n LogicalAggregate(group=[{0, 1}], $g=[GROUPING($0, $1)])\n LogicalProject(C=[>($5, 1000)], D=[<($5, 500)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctWithFilterAndGroupBy.json b/tests/calcite/testDistinctWithFilterAndGroupBy.json index 301c173..f7a87c0 100644 --- a/tests/calcite/testDistinctWithFilterAndGroupBy.json +++ b/tests/calcite/testDistinctWithFilterAndGroupBy.json @@ -1,566 +1,224 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT(DISTINCT $2) FILTER $3])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5], $f3=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[CAST($1):INTEGER NOT NULL], EXPR$2=[$2])\n LogicalAggregate(group=[{0}], EXPR$1=[MIN($2) FILTER $4], EXPR$2=[COUNT($1) FILTER $3])\n LogicalProject(DEPTNO=[$0], SAL=[$1], EXPR$1=[$3], $g_0_f_2=[AND(=($4, 0), IS TRUE($2))], $g_3=[=($4, 3)])\n LogicalAggregate(group=[{0, 2, 3}], groups=[[{0, 2, 3}, {0}]], EXPR$1=[SUM($1)], $g=[GROUPING($0, $2, $3)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5], $f3=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1000" + } ], + "operator" : ">" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "MIN", + "ignoreNulls" : false }, { - "operator" : "COUNT", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 3, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "BIGINT" - } ], - "source" : { - "distinct" : { - "correlate" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" }, { - "column" : 1, + "column" : 2, "type" : "INTEGER" }, { "column" : 3, - "type" : "INTEGER" - }, { - "operator" : "AND", + "type" : "BOOLEAN" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS TRUE", - "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "SUM", + "ignoreNulls" : false }, { - "operator" : "=", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 4, - "type" : "BIGINT" + "column" : 0, + "type" : "INTEGER" }, { - "operator" : "3", - "operand" : [ ], + "column" : 2, "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" - }, { - "column" : 6, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], + }, { + "column" : 3, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" - }, + "operator" : "GROUPING", + "ignoreNulls" : false + } ], "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 1, + "column" : 7, "type" : "INTEGER" }, { - "column" : 2, + "column" : 6, "type" : "INTEGER" }, { - "column" : 4, + "column" : 5, "type" : "INTEGER" }, { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS TRUE", - "operand" : [ { - "column" : 3, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, - "type" : "BIGINT" + "type" : "INTEGER" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1000" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "BOOLEAN" - }, { - "column" : 7, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + "operator" : ">" + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + } ], + "operator" : "IS TRUE" + } ], + "operator" : "AND" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "3" + } ], + "operator" : "=" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "CAST" + }, { + "column" : 2, + "type" : "BIGINT" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT(DISTINCT $2) FILTER $3])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5], $f3=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[CAST($1):INTEGER NOT NULL], EXPR$2=[$2])\n LogicalAggregate(group=[{0}], EXPR$1=[MIN($2) FILTER $4], EXPR$2=[COUNT($1) FILTER $3])\n LogicalProject(DEPTNO=[$0], SAL=[$1], EXPR$1=[$3], $g_0_f_2=[AND(=($4, 0), IS TRUE($2))], $g_3=[=($4, 3)])\n LogicalAggregate(group=[{0, 2, 3}], groups=[[{0, 2, 3}, {0}]], EXPR$1=[SUM($1)], $g=[GROUPING($0, $2, $3)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5], $f3=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctWithFilterWithoutGroupBy.json b/tests/calcite/testDistinctWithFilterWithoutGroupBy.json index 2870304..2b463c1 100644 --- a/tests/calcite/testDistinctWithFilterWithoutGroupBy.json +++ b/tests/calcite/testDistinctWithFilterWithoutGroupBy.json @@ -1,466 +1,185 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT(DISTINCT $1) FILTER $2])\n LogicalProject(COMM=[$6], SAL=[$5], $f2=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[MIN($1) FILTER $3], EXPR$1=[COUNT($0) FILTER $2])\n LogicalProject(SAL=[$0], EXPR$0=[$2], $g_0_f_1=[AND(=($3, 0), IS TRUE($1))], $g_3=[=($3, 3)])\n LogicalAggregate(group=[{1, 2}], groups=[[{1, 2}, {}]], EXPR$0=[SUM($0)], $g=[GROUPING($1, $2)])\n LogicalProject(COMM=[$6], SAL=[$5], $f2=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 5, "type" : "INTEGER" }, { - "operator" : "COUNT", + "type" : "BOOLEAN", "operand" : [ { - "column" : 1, + "column" : 5, "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1000" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "operator" : ">" + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "column" : 0, + "group" : { + "keys" : [ { + "column" : 1, "type" : "INTEGER" }, { "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "AND", + "type" : "BOOLEAN" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS TRUE", - "operand" : [ { - "column" : 1, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "SUM", + "ignoreNulls" : false }, { - "operator" : "=", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 3, - "type" : "BIGINT" - }, { - "operator" : "3", - "operand" : [ ], + "column" : 1, "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "GROUPING", + "ignoreNulls" : false } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "BOOLEAN" - }, { - "column" : 4, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 6, "type" : "INTEGER" }, { - "column" : 2, + "column" : 5, "type" : "INTEGER" }, { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS TRUE", - "operand" : [ { - "column" : 1, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 3, - "type" : "BIGINT" + "column" : 5, + "type" : "INTEGER" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1000" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "BOOLEAN" - }, { - "column" : 4, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + "operator" : ">" + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + } ], + "operator" : "IS TRUE" + } ], + "operator" : "AND" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "3" + } ], + "operator" : "=" + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT(DISTINCT $1) FILTER $2])\n LogicalProject(COMM=[$6], SAL=[$5], $f2=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[MIN($1) FILTER $3], EXPR$1=[COUNT($0) FILTER $2])\n LogicalProject(SAL=[$0], EXPR$0=[$2], $g_0_f_1=[AND(=($3, 0), IS TRUE($1))], $g_3=[=($3, 3)])\n LogicalAggregate(group=[{1, 2}], groups=[[{1, 2}, {}]], EXPR$0=[SUM($0)], $g=[GROUPING($1, $2)])\n LogicalProject(COMM=[$6], SAL=[$5], $f2=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctWithGrouping.json b/tests/calcite/testDistinctWithGrouping.json index 546bed0..8d944e0 100644 --- a/tests/calcite/testDistinctWithGrouping.json +++ b/tests/calcite/testDistinctWithGrouping.json @@ -1,324 +1,137 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[SUM(DISTINCT $0)])\n LogicalProject(SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($2)], EXPR$3=[SUM($0)])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalProject(SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "column" : 5, "type" : "INTEGER" }, { - "operator" : "SUM", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, + "column" : 6, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", + "type" : "INTEGER", "operand" : [ { - "column" : 3, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "MIN", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ] } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[SUM(DISTINCT $0)])\n LogicalProject(SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($2)], EXPR$3=[SUM($0)])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalProject(SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctWithMultipleInputs.json b/tests/calcite/testDistinctWithMultipleInputs.json index e384c56..6298311 100644 --- a/tests/calcite/testDistinctWithMultipleInputs.json +++ b/tests/calcite/testDistinctWithMultipleInputs.json @@ -1,400 +1,155 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[COUNT(DISTINCT $2, $1)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($3)], EXPR$2=[MIN($4)], EXPR$3=[COUNT($2, $1)])\n LogicalAggregate(group=[{0, 1, 2}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "column" : 7, "type" : "INTEGER" }, { - "operator" : "MIN", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "column" : 6, "type" : "INTEGER" }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "column" : 5, + "type" : "INTEGER" + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", + "type" : "INTEGER", "operand" : [ { - "column" : 5, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "SUM", + "ignoreNulls" : false }, { - "operator" : "COUNT", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 2, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "MIN", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ] } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[COUNT(DISTINCT $2, $1)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($3)], EXPR$2=[MIN($4)], EXPR$3=[COUNT($2, $1)])\n LogicalAggregate(group=[{0, 1, 2}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testDistinctWithMultipleInputsAndGroupby.json b/tests/calcite/testDistinctWithMultipleInputsAndGroupby.json index d4f29d1..6fb079d 100644 --- a/tests/calcite/testDistinctWithMultipleInputsAndGroupby.json +++ b/tests/calcite/testDistinctWithMultipleInputsAndGroupby.json @@ -1,406 +1,161 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[COUNT(DISTINCT $2, $0, $1)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($3)], EXPR$2=[MIN($4)], EXPR$3=[COUNT($2, $0, $1)])\n LogicalAggregate(group=[{0, 1, 2}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "column" : 7, "type" : "INTEGER" }, { - "operator" : "MIN", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "column" : 6, "type" : "INTEGER" }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "column" : 5, + "type" : "INTEGER" + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", + "type" : "INTEGER", "operand" : [ { - "column" : 5, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "SUM", + "ignoreNulls" : false }, { - "operator" : "COUNT", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { "column" : 1, "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "MIN", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ] } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)], EXPR$3=[COUNT(DISTINCT $2, $0, $1)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($3)], EXPR$2=[MIN($4)], EXPR$3=[COUNT($2, $0, $1)])\n LogicalAggregate(group=[{0, 1, 2}], EXPR$1=[SUM($1)], EXPR$2=[MIN($1)])\n LogicalProject(DEPTNO=[$7], COMM=[$6], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testEmptyAggregate.json b/tests/calcite/testEmptyAggregate.json index e1871b7..4cfce6f 100644 --- a/tests/calcite/testEmptyAggregate.json +++ b/tests/calcite/testEmptyAggregate.json @@ -1,73 +1,41 @@ { + "help" : [ "LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[SUM($1)])\n LogicalValues(tuples=[[]])\n", "LogicalValues(tuples=[[]])\n" ], "schemas" : [ ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "values" : { - "schema" : [ "INTEGER", "INTEGER" ], - "content" : [ ] - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "values" : { - "schema" : [ "INTEGER", "INTEGER" ], - "content" : [ ] - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ ] } - } ] + } } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ] } }, { "values" : { "schema" : [ "INTEGER" ], "content" : [ ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[SUM($1)])\n LogicalValues(tuples=[[]])\n", "LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json b/tests/calcite/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json index 1966230..387a424 100644 --- a/tests/calcite/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json +++ b/tests/calcite/testEmptyAggregateEmptyKeyWithAggregateValuesRule.json @@ -1,66 +1,44 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()], EXPR$1=[SUM($0)])\n LogicalValues(tuples=[[]])\n", "LogicalValues(tuples=[[{ 0, null }]])\n" ], "schemas" : [ ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "values" : { - "schema" : [ "INTEGER" ], - "content" : [ ] - } - } - } + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "values" : { - "schema" : [ "INTEGER" ], - "content" : [ ] - } - } - } - } + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "values" : { + "schema" : [ "INTEGER" ], + "content" : [ ] } - } ] + } } }, { "values" : { "schema" : [ "BIGINT", "INTEGER" ], "content" : [ [ { - "operator" : "0", + "type" : "BIGINT", "operand" : [ ], - "type" : "BIGINT" + "operator" : "0" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ] ] } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()], EXPR$1=[SUM($0)])\n LogicalValues(tuples=[[]])\n", "LogicalValues(tuples=[[{ 0, null }]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testEmptyFilterProjectUnion.json b/tests/calcite/testEmptyFilterProjectUnion.json index 22c6efa..faa5255 100644 --- a/tests/calcite/testEmptyFilterProjectUnion.json +++ b/tests/calcite/testEmptyFilterProjectUnion.json @@ -1,20 +1,14 @@ { + "help" : [ "LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>(+($0, $1), 30)])\n LogicalUnion(all=[true])\n LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 20, 2 }]])\n", "LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n" ], "schemas" : [ ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -22,100 +16,106 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "+" }, { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "union" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], [ { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" } ] ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ [ { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ] ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] } } ] } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ [ { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" } ] ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>(+($0, $1), 30)])\n LogicalUnion(all=[true])\n LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 20, 2 }]])\n", "LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testEmptyIntersect.json b/tests/calcite/testEmptyIntersect.json index 2d83054..a4a8298 100644 --- a/tests/calcite/testEmptyIntersect.json +++ b/tests/calcite/testEmptyIntersect.json @@ -1,103 +1,104 @@ { + "help" : [ "LogicalIntersect(all=[false])\n LogicalIntersect(all=[false])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 50)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n", "LogicalValues(tuples=[[]])\n" ], "schemas" : [ ], "queries" : [ { "intersect" : [ { "intersect" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ [ { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" } ] ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "50", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "50" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], [ { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" } ] ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] } } ] }, { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ [ { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" } ] ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] } } ] }, { @@ -105,6 +106,5 @@ "schema" : [ "INTEGER", "INTEGER" ], "content" : [ ] } - } ], - "help" : [ "LogicalIntersect(all=[false])\n LogicalIntersect(all=[false])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 50)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n", "LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testEmptyMinus.json b/tests/calcite/testEmptyMinus.json index 53f9449..f15e344 100644 --- a/tests/calcite/testEmptyMinus.json +++ b/tests/calcite/testEmptyMinus.json @@ -1,106 +1,102 @@ { + "help" : [ "LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 30)])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 20, 2 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 40, 4 }]])\n", "LogicalValues(tuples=[[]])\n" ], "schemas" : [ ], "queries" : [ { - "distinct" : { + "except" : [ { "except" : [ { - "distinct" : { - "except" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "values" : { - "schema" : [ "INTEGER", "INTEGER" ], - "content" : [ [ { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ] ] - } - } - } - } - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "30" + } ], + "operator" : ">" + }, "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ [ { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" } ] ] } } } - } ] - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ [ { - "operator" : "40", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" }, { - "operator" : "4", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ] ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] } } ] - } + }, { + "project" : { + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "40" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "4" + } ] ] + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] + } + } ] }, { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ ] } - } ], - "help" : [ "LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 30)])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 20, 2 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 40, 4 }]])\n", "LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testEmptyMinus2.json b/tests/calcite/testEmptyMinus2.json index 928985d..d1c6623 100644 --- a/tests/calcite/testEmptyMinus2.json +++ b/tests/calcite/testEmptyMinus2.json @@ -1,197 +1,189 @@ { + "help" : [ "LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 30)])\n LogicalValues(tuples=[[{ 20, 2 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 40, 4 }]])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 50)])\n LogicalValues(tuples=[[{ 50, 5 }]])\n", "LogicalMinus(all=[false])\n LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 40, 4 }]])\n" ], "schemas" : [ ], "queries" : [ { - "distinct" : { + "except" : [ { "except" : [ { - "distinct" : { - "except" : [ { - "distinct" : { - "except" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "values" : { - "schema" : [ "INTEGER", "INTEGER" ], - "content" : [ [ { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ] ] - } - } - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "values" : { - "schema" : [ "INTEGER", "INTEGER" ], - "content" : [ [ { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ] ] - } - } - } - } - } - } ] - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "values" : { - "schema" : [ "INTEGER", "INTEGER" ], - "content" : [ [ { - "operator" : "40", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - } ] ] - } - } - } - } ] - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" + "except" : [ { + "project" : { + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "30" }, { - "operator" : "50", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "values" : { - "schema" : [ "INTEGER", "INTEGER" ], - "content" : [ [ { - "operator" : "50", - "operand" : [ ], + "operator" : "3" + } ] ] + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] + } + }, { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, "type" : "INTEGER" }, { - "operator" : "5", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" - } ] ] + "operator" : "30" + } ], + "operator" : ">" + }, + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ] ] + } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] } - } - } ] - } - }, { - "distinct" : { - "except" : [ { + } ] + }, { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ [ { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "40" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "4" } ] ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "INTEGER" - } ], - "source" : { - "values" : { - "schema" : [ "INTEGER", "INTEGER" ], - "content" : [ [ { - "operator" : "40", - "operand" : [ ], + } ] + } + } ] + }, { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, "type" : "INTEGER" }, { - "operator" : "4", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" - } ] ] + "operator" : "50" + } ], + "operator" : ">" + }, + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "50" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "5" + } ] ] + } } } - } - } ] - } - } ], - "help" : [ "LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 30)])\n LogicalValues(tuples=[[{ 20, 2 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 40, 4 }]])\n LogicalProject(X=[$0], Y=[$1])\n LogicalFilter(condition=[>($0, 50)])\n LogicalValues(tuples=[[{ 50, 5 }]])\n", "LogicalMinus(all=[false])\n LogicalProject(X=[$0], Y=[$1])\n LogicalValues(tuples=[[{ 30, 3 }]])\n LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[{ 40, 4 }]])\n" ] + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] + } + } ] + }, { + "except" : [ { + "project" : { + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "30" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "3" + } ] ] + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] + } + }, { + "project" : { + "source" : { + "values" : { + "schema" : [ "INTEGER", "INTEGER" ], + "content" : [ [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "40" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "4" + } ] ] + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] + } + } ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testEmptyProject.json b/tests/calcite/testEmptyProject.json index 6d576b5..b58acb7 100644 --- a/tests/calcite/testEmptyProject.json +++ b/tests/calcite/testEmptyProject.json @@ -1,31 +1,14 @@ { + "help" : [ "LogicalProject(EXPR$0=[+(+($0, $1), $0)])\n LogicalFilter(condition=[>(+($0, $1), 50)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n", "LogicalValues(tuples=[[]])\n" ], "schemas" : [ ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "+", - "operand" : [ { - "operator" : "+", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -33,44 +16,61 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "+" }, { - "operator" : "50", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "50" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], [ { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" } ] ] } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "+" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "+" + } ] } }, { "values" : { "schema" : [ "INTEGER" ], "content" : [ ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[+(+($0, $1), $0)])\n LogicalFilter(condition=[>(+($0, $1), 50)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n", "LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testEmptyProject2.json b/tests/calcite/testEmptyProject2.json index 6d576b5..b58acb7 100644 --- a/tests/calcite/testEmptyProject2.json +++ b/tests/calcite/testEmptyProject2.json @@ -1,31 +1,14 @@ { + "help" : [ "LogicalProject(EXPR$0=[+(+($0, $1), $0)])\n LogicalFilter(condition=[>(+($0, $1), 50)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n", "LogicalValues(tuples=[[]])\n" ], "schemas" : [ ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "+", - "operand" : [ { - "operator" : "+", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -33,44 +16,61 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "+" }, { - "operator" : "50", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "50" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], [ { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" } ] ] } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "+" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "+" + } ] } }, { "values" : { "schema" : [ "INTEGER" ], "content" : [ ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[+(+($0, $1), $0)])\n LogicalFilter(condition=[>(+($0, $1), 50)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])\n", "LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testEmptySort.json b/tests/calcite/testEmptySort.json index 9aaf6a7..50baee2 100644 --- a/tests/calcite/testEmptySort.json +++ b/tests/calcite/testEmptySort.json @@ -1,17 +1,31 @@ { + "help" : [ "LogicalSort(sort0=[$7], dir0=[ASC])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalValues(tuples=[[]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "sort" : { - "collation" : [ [ 7, "INTEGER", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -39,27 +53,15 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "false", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } - } + }, + "collation" : [ [ 7, "INTEGER", "ASCENDING" ] ] } }, { "values" : { "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], "content" : [ ] } - } ], - "help" : [ "LogicalSort(sort0=[$7], dir0=[ASC])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testEmptySort2.json b/tests/calcite/testEmptySort2.json index a92a47d..7c87e4b 100644 --- a/tests/calcite/testEmptySort2.json +++ b/tests/calcite/testEmptySort2.json @@ -1,20 +1,22 @@ { + "help" : [ "LogicalSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[ASC])\n LogicalValues(tuples=[[]])\n", "LogicalValues(tuples=[[]])\n" ], "schemas" : [ ], "queries" : [ { "sort" : { - "collation" : [ [ 1, "VARCHAR", "ASC" ], [ 0, "TINYINT", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "values" : { "schema" : [ "TINYINT", "VARCHAR", "VARCHAR" ], "content" : [ ] } - } + }, + "collation" : [ [ 1, "VARCHAR", "ASCENDING" ], [ 0, "TINYINT", "ASCENDING" ] ] } }, { "values" : { "schema" : [ "TINYINT", "VARCHAR", "VARCHAR" ], "content" : [ ] } - } ], - "help" : [ "LogicalSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[ASC])\n LogicalValues(tuples=[[]])\n", "LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testEmptySortLimitZero.json b/tests/calcite/testEmptySortLimitZero.json index 7d9f9c7..f957c7c 100644 --- a/tests/calcite/testEmptySortLimitZero.json +++ b/tests/calcite/testEmptySortLimitZero.json @@ -1,22 +1,26 @@ { + "help" : [ "LogicalSort(sort0=[$7], dir0=[ASC], fetch=[0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalValues(tuples=[[]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "sort" : { - "collation" : [ [ 7, "INTEGER", "ASC" ] ], + "offset" : null, "limit" : { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -44,18 +48,15 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + } ] } - } + }, + "collation" : [ [ 7, "INTEGER", "ASCENDING" ] ] } }, { "values" : { "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], "content" : [ ] } - } ], - "help" : [ "LogicalSort(sort0=[$7], dir0=[ASC], fetch=[0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testEmptyTable.json b/tests/calcite/testEmptyTable.json new file mode 100644 index 0000000..77b07b6 --- /dev/null +++ b/tests/calcite/testEmptyTable.json @@ -0,0 +1,33 @@ +{ + "help" : [ "LogicalProject(PRODUCTID=[$0], NAME=[$1], SUPPLIERID=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMPTY_PRODUCTS]])\n", "LogicalValues(tuples=[[]])\n" ], + "schemas" : [ { + "types" : [ "INTEGER", "VARCHAR", "INTEGER" ], + "nullable" : [ false, false, false ], + "name" : "CATALOG.SALES.EMPTY_PRODUCTS", + "guaranteed" : [ ], + "fields" : [ "PRODUCTID", "NAME", "SUPPLIERID" ], + "key" : [ ] + } ], + "queries" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ] + } + }, { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "INTEGER" ], + "content" : [ ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testEmptyTableTransformsComplexQueryToSingleTableScan.json b/tests/calcite/testEmptyTableTransformsComplexQueryToSingleTableScan.json new file mode 100644 index 0000000..830bfcf --- /dev/null +++ b/tests/calcite/testEmptyTableTransformsComplexQueryToSingleTableScan.json @@ -0,0 +1,122 @@ +{ + "help" : [ "LogicalProject(PRODUCTID=[$0], NAME=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, PRODUCTS]])\n LogicalProject(PRODUCTID=[$0], NAME=[$1], SUPPLIERID=[$2], PRODUCTID0=[$3], NAME0=[$4], SUPPLIERID0=[$5])\n LogicalFilter(condition=[>($2, 10)])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, PRODUCTS]])\n LogicalTableScan(table=[[CATALOG, SALES, EMPTY_PRODUCTS]])\n", "LogicalProject(PRODUCTID=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, PRODUCTS]])\n" ], + "schemas" : [ { + "types" : [ "INTEGER", "VARCHAR", "INTEGER" ], + "nullable" : [ false, false, false ], + "name" : "CATALOG.SALES.PRODUCTS", + "guaranteed" : [ ], + "fields" : [ "PRODUCTID", "NAME", "SUPPLIERID" ], + "key" : [ ] + }, { + "types" : [ "INTEGER", "VARCHAR", "INTEGER" ], + "nullable" : [ false, false, false ], + "name" : "CATALOG.SALES.EMPTY_PRODUCTS", + "guaranteed" : [ ], + "fields" : [ "PRODUCTID", "NAME", "SUPPLIERID" ], + "key" : [ ] + } ], + "queries" : [ { + "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : ">" + }, + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "scan" : 1 + } + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] + } + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testExistsWithAtLeastOneRowSubQuery.json b/tests/calcite/testExistsWithAtLeastOneRowSubQuery.json index 35561cb..fad1c47 100644 --- a/tests/calcite/testExistsWithAtLeastOneRowSubQuery.json +++ b/tests/calcite/testExistsWithAtLeastOneRowSubQuery.json @@ -1,136 +1,93 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[EXISTS({\nLogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[0])\n LogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], - "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] - }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR" ], + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "EXISTS", - "operand" : [ ], "query" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" }, "source" : { - "project" : { - "target" : [ { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ] } - } ] + } } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "EXISTS" }, "source" : { - "scan" : 0 + "scan" : 1 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] } }, { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[EXISTS({\nLogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[0])\n LogicalFilter(condition=[=($cor0.DEPTNO, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExistsWithNoRowSubQuery.json b/tests/calcite/testExistsWithNoRowSubQuery.json index 4e89c3d..5a0628a 100644 --- a/tests/calcite/testExistsWithNoRowSubQuery.json +++ b/tests/calcite/testExistsWithNoRowSubQuery.json @@ -1,57 +1,57 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[NOT(EXISTS({\nLogicalValues(tuples=[[]])\n}))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "NOT", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "EXISTS", - "operand" : [ ], "query" : { "values" : { "schema" : [ "BIGINT" ], "content" : [ ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "EXISTS" } ], - "type" : "BOOLEAN" + "operator" : "NOT" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[NOT(EXISTS({\nLogicalValues(tuples=[[]])\n}))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExpandFilterConstantInCorrelatedWithTwoSubQueries.json b/tests/calcite/testExpandFilterConstantInCorrelatedWithTwoSubQueries.json new file mode 100644 index 0000000..03683f1 --- /dev/null +++ b/tests/calcite/testExpandFilterConstantInCorrelatedWithTwoSubQueries.json @@ -0,0 +1,460 @@ +{ + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IN(1, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[AND(=($cor0.ENAME, CAST($1):VARCHAR(20)), >($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n}), IN(2, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[AND(=($cor0.ENAME, CAST($1):VARCHAR(20)), <($0, 20))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n}))], variablesSet=[[$cor0]])\n LogicalProject(EMPNO=[$0], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1])\n LogicalFilter(condition=[OR(CASE(=($2, false), null:BOOLEAN, IS NOT NULL($2), true, false), CASE(=($3, false), null:BOOLEAN, IS NOT NULL($3), true, false))])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{1}])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{1}])\n LogicalProject(EMPNO=[$0], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalAggregate(group=[{0}])\n LogicalProject(cs=[IS NOT NULL($0)])\n LogicalFilter(condition=[OR(=(1, $0), IS NULL($0))])\n LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[AND(=($cor0.ENAME, CAST($1):VARCHAR(20)), >($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n LogicalAggregate(group=[{0}])\n LogicalProject(cs=[IS NOT NULL($0)])\n LogicalFilter(condition=[OR(=(2, $0), IS NULL($0))])\n LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[AND(=($cor0.ENAME, CAST($1):VARCHAR(20)), <($0, 20))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n" ], + "schemas" : [ { + "types" : [ "INTEGER", "VARCHAR" ], + "nullable" : [ true, true ], + "name" : "CATALOG.SALES.DEPTNULLABLES", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, true, true, true, true, true, true, true, true ], + "name" : "CATALOG.SALES.EMPNULLABLES", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + } ], + "queries" : [ { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "query" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : ">" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ] + } + }, + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "IN" + }, { + "query" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "<" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ] + } + }, + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ], + "operator" : "IN" + } ], + "operator" : "OR" + }, + "source" : { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + }, { + "project" : { + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + } ], + "operator" : "CASE" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "BOOLEAN" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "BOOLEAN" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + } ], + "operator" : "CASE" + } ], + "operator" : "OR" + }, + "source" : { + "correlate" : { + "left" : { + "correlate" : { + "left" : { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] + } + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "BOOLEAN" + } ], + "function" : [ ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" + } ], + "operator" : "OR" + }, + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : ">" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "IS NOT NULL" + } ] + } + } + } + } + } + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ { + "column" : 3, + "type" : "BOOLEAN" + } ], + "function" : [ ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" + } ], + "operator" : "OR" + }, + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "<" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "IS NOT NULL" + } ] + } + } + } + } + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandFilterConstantInWithTwoSubQueries.json b/tests/calcite/testExpandFilterConstantInWithTwoSubQueries.json new file mode 100644 index 0000000..4f74e4f --- /dev/null +++ b/tests/calcite/testExpandFilterConstantInWithTwoSubQueries.json @@ -0,0 +1,429 @@ +{ + "help" : [ "LogicalFilter(condition=[OR(IN(1, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($1, 'dept1')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n}), IN(2, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($1, 'dept2')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n}))])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(CASE(IS NULL($2), false, =($1, false), null:BOOLEAN, IS NOT NULL($1), true, false), CASE(IS NULL($4), false, =($3, false), null:BOOLEAN, IS NOT NULL($3), true, false))])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalSort(sort0=[$0], dir0=[DESC], fetch=[1])\n LogicalAggregate(group=[{0}], c=[COUNT()])\n LogicalProject(cs=[IS NOT NULL($0)])\n LogicalFilter(condition=[OR(=(1, $0), IS NULL($0))])\n LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($1, 'dept1')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n LogicalSort(sort0=[$0], dir0=[DESC], fetch=[1])\n LogicalAggregate(group=[{0}], c=[COUNT()])\n LogicalProject(cs=[IS NOT NULL($0)])\n LogicalFilter(condition=[OR(=(2, $0), IS NULL($0))])\n LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($1, 'dept2')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n" ], + "schemas" : [ { + "types" : [ "INTEGER", "VARCHAR" ], + "nullable" : [ true, true ], + "name" : "CATALOG.SALES.DEPTNULLABLES", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, true, true, true, true, true, true, true, true ], + "name" : "CATALOG.SALES.EMPNULLABLES", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + } ], + "queries" : [ { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "query" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept1'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ] + } + }, + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "IN" + }, { + "query" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept2'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ] + } + }, + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ], + "operator" : "IN" + } ], + "operator" : "OR" + }, + "source" : { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + } ], + "operator" : "IS NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + } ], + "operator" : "CASE" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + } ], + "operator" : "IS NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "BOOLEAN" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "BOOLEAN" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + } ], + "operator" : "CASE" + } ], + "operator" : "OR" + }, + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, + "left" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, + "left" : { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + }, + "kind" : "LEFT", + "right" : { + "sort" : { + "offset" : null, + "limit" : { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" + } ], + "operator" : "OR" + }, + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept1'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "IS NOT NULL" + } ] + } + } + } + }, + "collation" : [ [ 0, "BOOLEAN", "DESCENDING" ] ] + } + } + } + }, + "kind" : "LEFT", + "right" : { + "sort" : { + "offset" : null, + "limit" : { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" + } ], + "operator" : "OR" + }, + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept2'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "IS NOT NULL" + } ] + } + } + } + }, + "collation" : [ [ 0, "BOOLEAN", "DESCENDING" ] ] + } + } + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandFilterExists.json b/tests/calcite/testExpandFilterExists.json index ccdac9c..388a3d8 100644 --- a/tests/calcite/testExpandFilterExists.json +++ b/tests/calcite/testExpandFilterExists.json @@ -1,235 +1,181 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($5, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IS NOT NULL($9), <($5, 100))])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "EXISTS", - "operand" : [ ], "query" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "EXISTS" }, { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : "<" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : "<" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "BOOLEAN" - }, { - "column" : 1, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] } - } ] + } } } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($5, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IS NOT NULL($9), <($5, 100))])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExpandFilterExistsSimple.json b/tests/calcite/testExpandFilterExistsSimple.json index 087e87e..c47a5f8 100644 --- a/tests/calcite/testExpandFilterExistsSimple.json +++ b/tests/calcite/testExpandFilterExistsSimple.json @@ -1,58 +1,105 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "EXISTS", - "operand" : [ ], "query" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "EXISTS" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "function" : [ ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "<" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] + } + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -80,114 +127,13 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "BOOLEAN" - }, { - "column" : 1, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - } - } - } + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExpandFilterExistsSimpleAnd.json b/tests/calcite/testExpandFilterExistsSimpleAnd.json index a88971e..79ca6ae 100644 --- a/tests/calcite/testExpandFilterExistsSimpleAnd.json +++ b/tests/calcite/testExpandFilterExistsSimpleAnd.json @@ -1,224 +1,170 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[AND(EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($5, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[<($5, 100)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "EXISTS", - "operand" : [ ], "query" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "EXISTS" }, { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : "<" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "BOOLEAN" - }, { - "column" : 1, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] } - } ] + } } } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[AND(EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($5, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[<($5, 100)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExpandFilterIn.json b/tests/calcite/testExpandFilterIn.json index 5e3b54e..ac00c13 100644 --- a/tests/calcite/testExpandFilterIn.json +++ b/tests/calcite/testExpandFilterIn.json @@ -1,142 +1,110 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IN($7, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($5, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IS NOT NULL($10), <($5, 100))])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], i=[LITERAL_AGG(true)])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IN", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "query" : { "project" : { - "target" : [ { - "column" : 16, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 16, + "type" : "INTEGER" + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "IN" }, { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : "<" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : "<" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -144,128 +112,92 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "LITERAL_AGG", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } - } ] + } } } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IN($7, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($5, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IS NOT NULL($10), <($5, 100))])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExpandFilterIn3Value.json b/tests/calcite/testExpandFilterIn3Value.json index f2b1076..c696919 100644 --- a/tests/calcite/testExpandFilterIn3Value.json +++ b/tests/calcite/testExpandFilterIn3Value.json @@ -1,243 +1,212 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[<($0, CASE(=(IN($7, {\nLogicalProject(EXPR$0=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), true), 10, =(IN($7, {\nLogicalProject(EXPR$0=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), false), 20, 30))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[<($0, CASE(=(CASE(=($9, 0), false, IS NOT NULL($12), true, <($10, $9), null:BOOLEAN, false), true), 10, =(CASE(=($9, 0), false, IS NOT NULL($12), true, <($10, $9), null:BOOLEAN, false), false), 20, 30))])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(EXPR$0=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], i=[LITERAL_AGG(true)])\n LogicalProject(EXPR$0=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IN", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "query" : { "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 16, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } - } - } - }, - "type" : "BOOLEAN" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "operator" : "IN", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "query" : { - "project" : { + }, "target" : [ { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 16, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "INTEGER" - } ], + "operator" : "CASE" + } ] + } + }, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "IN" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "query" : { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + } ], + "operator" : "CAST" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + } ], + "operator" : "CASE" + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "IN" }, { - "operator" : "false", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "false" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" }, { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" } ], - "type" : "INTEGER" + "operator" : "CASE" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "CASE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "false", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "false" }, { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 12, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" @@ -245,59 +214,59 @@ "column" : 9, "type" : "BIGINT" } ], - "type" : "BOOLEAN" + "operator" : "<" }, { - "operator" : "NULL", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "NULL" }, { - "operator" : "false", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "false" } ], - "type" : "BOOLEAN" + "operator" : "CASE" }, { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "CASE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "false", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "false" }, { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 12, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" @@ -305,41 +274,40 @@ "column" : 9, "type" : "BIGINT" } ], - "type" : "BOOLEAN" + "operator" : "<" }, { - "operator" : "NULL", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "NULL" }, { - "operator" : "false", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "false" } ], - "type" : "BOOLEAN" + "operator" : "CASE" }, { - "operator" : "false", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "false" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" }, { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" } ], - "type" : "INTEGER" + "operator" : "CASE" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -347,293 +315,182 @@ "column" : 11, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", + "filter" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], + "column" : 0, "type" : "INTEGER" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } - } - } ] - } - } - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { + }, "target" : [ { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "INTEGER" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + "operator" : "CASE" + } ] } } } - }, { - "aggregate" : { - "function" : [ ], + } + } + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "LITERAL_AGG", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "CAST" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + } ], + "operator" : "CASE" + } ] } - } ] + } } } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[<($0, CASE(=(IN($7, {\nLogicalProject(EXPR$0=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), true), 10, =(IN($7, {\nLogicalProject(EXPR$0=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), false), 20, 30))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[<($0, CASE(=(CASE(=($9, 0), false, IS NOT NULL($12), true, <($10, $9), null:BOOLEAN, false), true), 10, =(CASE(=($9, 0), false, IS NOT NULL($12), true, <($10, $9), null:BOOLEAN, false), false), 20, 30))])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(EXPR$0=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(EXPR$0=[CASE(true, CAST($7):INTEGER, null:INTEGER)], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExpandFilterInComposite.json b/tests/calcite/testExpandFilterInComposite.json index 0ed925b..f1cab93 100644 --- a/tests/calcite/testExpandFilterInComposite.json +++ b/tests/calcite/testExpandFilterInComposite.json @@ -1,150 +1,118 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($5, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IS NOT NULL($11), <($5, 100))])\n LogicalJoin(condition=[AND(=($0, $9), =($7, $10))], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IN", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], "query" : { "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "IN" }, { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : "<" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 11, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : "<" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -152,9 +120,9 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -162,54 +130,86 @@ "column" : 10, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] } } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($5, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IS NOT NULL($11), <($5, 100))])\n LogicalJoin(condition=[AND(=($0, $9), =($7, $10))], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExpandFilterInCorrelatedWithTwoSubQueries.json b/tests/calcite/testExpandFilterInCorrelatedWithTwoSubQueries.json new file mode 100644 index 0000000..8b659c4 --- /dev/null +++ b/tests/calcite/testExpandFilterInCorrelatedWithTwoSubQueries.json @@ -0,0 +1,601 @@ +{ + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IN($2, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[AND(=($cor0.ENAME, CAST($1):VARCHAR(20)), >($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n}), IN($2, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[AND(=($cor0.ENAME, CAST($1):VARCHAR(20)), <($0, 20))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n}))], variablesSet=[[$cor0]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], DEPTNO=[$2])\n LogicalFilter(condition=[OR(CASE(=($3, 0), false, IS NULL($2), null:BOOLEAN, IS NOT NULL($6), true, <($4, $3), null:BOOLEAN, false), CASE(=($7, 0), false, IS NULL($2), null:BOOLEAN, IS NOT NULL($10), true, <($8, $7), null:BOOLEAN, false))])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{1, 2}])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{1}])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{1, 2}])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{1}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[AND(=($cor0.ENAME, CAST($1):VARCHAR(20)), >($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalProject(DEPTNO=[$0], i=[true])\n LogicalFilter(condition=[AND(=($cor0.ENAME, CAST($1):VARCHAR(20)), >($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[AND(=($cor0.ENAME, CAST($1):VARCHAR(20)), <($0, 20))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalProject(DEPTNO=[$0], i=[true])\n LogicalFilter(condition=[AND(=($cor0.ENAME, CAST($1):VARCHAR(20)), <($0, 20))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n" ], + "schemas" : [ { + "types" : [ "INTEGER", "VARCHAR" ], + "nullable" : [ true, true ], + "name" : "CATALOG.SALES.DEPTNULLABLES", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, true, true, true, true, true, true, true, true ], + "name" : "CATALOG.SALES.EMPNULLABLES", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + } ], + "queries" : [ { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "query" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : ">" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ] + } + }, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "IN" + }, { + "query" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "<" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ] + } + }, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "IN" + } ], + "operator" : "OR" + }, + "source" : { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + }, { + "project" : { + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 6, + "type" : "BOOLEAN" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "operator" : "<" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + } ], + "operator" : "CASE" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 10, + "type" : "BOOLEAN" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "column" : 7, + "type" : "BIGINT" + } ], + "operator" : "<" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + } ], + "operator" : "CASE" + } ], + "operator" : "OR" + }, + "source" : { + "correlate" : { + "left" : { + "correlate" : { + "left" : { + "correlate" : { + "left" : { + "correlate" : { + "left" : { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ] + } + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : ">" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ] + } + } + } + } + } + }, + "kind" : "LEFT", + "right" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 6, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : ">" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] + } + } + } + } + } + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 8, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "<" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] + } + } + } + } + } + }, + "kind" : "LEFT", + "right" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "<" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] + } + } + } + } + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ] + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandFilterInWithTwoSubQueries.json b/tests/calcite/testExpandFilterInWithTwoSubQueries.json new file mode 100644 index 0000000..4658655 --- /dev/null +++ b/tests/calcite/testExpandFilterInWithTwoSubQueries.json @@ -0,0 +1,486 @@ +{ + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IN($1, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($1, 'dept1')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n}), IN($1, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($1, 'dept2')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n}))])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], DEPTNO=[$1])\n LogicalFilter(condition=[OR(CASE(=($2, 0), false, IS NULL($1), null:BOOLEAN, IS NOT NULL($5), true, <($3, $2), null:BOOLEAN, false), CASE(=($6, 0), false, IS NULL($1), null:BOOLEAN, IS NOT NULL($9), true, <($7, $6), null:BOOLEAN, false))])\n LogicalJoin(condition=[=($1, $8)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[=($1, $4)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($1, 'dept1')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n LogicalProject(DEPTNO=[$0], i=[true])\n LogicalFilter(condition=[=($1, 'dept1')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($1, 'dept2')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n LogicalProject(DEPTNO=[$0], i=[true])\n LogicalFilter(condition=[=($1, 'dept2')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n" ], + "schemas" : [ { + "types" : [ "INTEGER", "VARCHAR" ], + "nullable" : [ true, true ], + "name" : "CATALOG.SALES.DEPTNULLABLES", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, true, true, true, true, true, true, true, true ], + "name" : "CATALOG.SALES.EMPNULLABLES", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + } ], + "queries" : [ { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "query" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept1'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ] + } + }, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "IN" + }, { + "query" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept2'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ] + } + }, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "IN" + } ], + "operator" : "OR" + }, + "source" : { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + }, { + "project" : { + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "BOOLEAN" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "BIGINT" + } ], + "operator" : "<" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + } ], + "operator" : "CASE" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "BIGINT" + }, { + "column" : 6, + "type" : "BIGINT" + } ], + "operator" : "<" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + } ], + "operator" : "CASE" + } ], + "operator" : "OR" + }, + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, + "left" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, + "left" : { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ] + } + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept1'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + } + } + }, + "kind" : "LEFT", + "right" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept1'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] + } + } + } + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept2'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + } + } + }, + "kind" : "LEFT", + "right" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept2'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] + } + } + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandFilterScalar.json b/tests/calcite/testExpandFilterScalar.json index 57d47b6..fdd46ca 100644 --- a/tests/calcite/testExpandFilterScalar.json +++ b/tests/calcite/testExpandFilterScalar.json @@ -1,150 +1,119 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(<($SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), $SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})), <($5, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(<($9, $10), <($5, 100))])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "$SCALAR_QUERY", - "operand" : [ ], "query" : { "project" : { - "target" : [ { - "column" : 16, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 16, + "type" : "INTEGER" + } ] } }, - "type" : "INTEGER" - }, { - "operator" : "$SCALAR_QUERY", + "type" : "INTEGER", "operand" : [ ], + "operator" : "$SCALAR_QUERY" + }, { "query" : { "project" : { - "target" : [ { - "column" : 16, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 16, + "type" : "INTEGER" + } ] } }, - "type" : "INTEGER" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "$SCALAR_QUERY" } ], - "type" : "BOOLEAN" + "operator" : "<" }, { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : "<" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" @@ -152,219 +121,164 @@ "column" : 10, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "<" }, { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : "<" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SINGLE_VALUE", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - } - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SINGLE_VALUE", + "ignoreNulls" : false + } ], "source" : { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } } } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SINGLE_VALUE", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], + } + } + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SINGLE_VALUE", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "100" + } ], + "operator" : ">" }, "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "100", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } - } ] + } } } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(<($SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), $SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})), <($5, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(<($9, $10), <($5, 100))])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExpandJoinExists.json b/tests/calcite/testExpandJoinExists.json index fc923cc..a98f764 100644 --- a/tests/calcite/testExpandJoinExists.json +++ b/tests/calcite/testExpandJoinExists.json @@ -1,223 +1,169 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "EXISTS", - "operand" : [ ], "query" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 11, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "EXISTS" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 1 }, + "kind" : "INNER", "right" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "BOOLEAN" - }, { - "column" : 1, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] } - } ] + } } } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExpandJoinScalar.json b/tests/calcite/testExpandJoinScalar.json index 09c5112..04cebea 100644 --- a/tests/calcite/testExpandJoinScalar.json +++ b/tests/calcite/testExpandJoinScalar.json @@ -1,190 +1,115 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[<($SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), $SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10], $f0=[$11])\n LogicalJoin(condition=[<($11, $12)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "$SCALAR_QUERY", - "operand" : [ ], "query" : { "project" : { - "target" : [ { - "column" : 18, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 11, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 18, + "type" : "INTEGER" + } ] } }, - "type" : "INTEGER" - }, { - "operator" : "$SCALAR_QUERY", + "type" : "INTEGER", "operand" : [ ], + "operator" : "$SCALAR_QUERY" + }, { "query" : { "project" : { - "target" : [ { - "column" : 18, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 11, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 18, + "type" : "INTEGER" + } ] } }, - "type" : "INTEGER" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "$SCALAR_QUERY" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 11, "type" : "INTEGER" @@ -192,211 +117,200 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 1 }, + "kind" : "LEFT", "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SINGLE_VALUE", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - } - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SINGLE_VALUE", + "ignoreNulls" : false + } ], "source" : { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } } } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SINGLE_VALUE", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], + } + } + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SINGLE_VALUE", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "100" + } ], + "operator" : ">" }, "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "100", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } - } ] + } } } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "INTEGER" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[<($SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), $SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10], $f0=[$11])\n LogicalJoin(condition=[<($11, $12)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($0, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExpandProjectExists.json b/tests/calcite/testExpandProjectExists.json index 56faae1..e527587 100644 --- a/tests/calcite/testExpandProjectExists.json +++ b/tests/calcite/testExpandProjectExists.json @@ -1,163 +1,109 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], D=[EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], D=[IS NOT NULL($9)])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "EXISTS", - "operand" : [ ], "query" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } }, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "EXISTS" + } ] } }, { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "IS NOT NULL", - "operand" : [ { - "column" : 9, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "BOOLEAN" - }, { - "column" : 1, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] } - } ] + } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "operator" : "IS NOT NULL" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], D=[EXISTS({\nLogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], D=[IS NOT NULL($9)])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExpandProjectIn.json b/tests/calcite/testExpandProjectIn.json index aad384c..788b598 100644 --- a/tests/calcite/testExpandProjectIn.json +++ b/tests/calcite/testExpandProjectIn.json @@ -1,86 +1,63 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], D=[IN($7, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], D=[CASE(IS NOT NULL($10), true, false)])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], i=[LITERAL_AGG(true)])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "IN", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "query" : { "project" : { - "target" : [ { - "column" : 16, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 16, + "type" : "INTEGER" + } ] } }, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "IN" + } ] } }, { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "IS NOT NULL", - "operand" : [ { - "column" : 10, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "false", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -88,124 +65,79 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "LITERAL_AGG", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } - } ] + } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 10, + "type" : "BOOLEAN" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + } ], + "operator" : "CASE" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], D=[IN($7, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], D=[CASE(IS NOT NULL($10), true, false)])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExpandProjectInComposite.json b/tests/calcite/testExpandProjectInComposite.json index 70d2473..c665c67 100644 --- a/tests/calcite/testExpandProjectInComposite.json +++ b/tests/calcite/testExpandProjectInComposite.json @@ -1,94 +1,71 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], D=[IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], D=[CASE(IS NOT NULL($11), true, false)])\n LogicalJoin(condition=[AND(=($0, $9), =($7, $10))], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "IN", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], "query" : { "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + } ] } }, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "CASE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NOT NULL", - "operand" : [ { - "column" : 11, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "INTEGER" }, { - "operator" : "false", - "operand" : [ ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" - } ], + "operator" : "IN" + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -96,9 +73,9 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -106,50 +83,73 @@ "column" : 10, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 11, + "type" : "BOOLEAN" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + } ], + "operator" : "CASE" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], D=[IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], D=[CASE(IS NOT NULL($11), true, false)])\n LogicalJoin(condition=[AND(=($0, $9), =($7, $10))], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExpandProjectInNullable.json b/tests/calcite/testExpandProjectInNullable.json index d5e61d6..9f29dca 100644 --- a/tests/calcite/testExpandProjectInNullable.json +++ b/tests/calcite/testExpandProjectInNullable.json @@ -1,535 +1,370 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], D=[IN(CASE(true, CAST($7):INTEGER, null:INTEGER), {\nLogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], D=[CASE(=($9, 0), false, IS NULL(CASE(true, CAST($7):INTEGER, null:INTEGER)), null:BOOLEAN, IS NOT NULL($12), true, <($10, $9), null:BOOLEAN, false)])\n LogicalJoin(condition=[=(CASE(true, CAST($7):INTEGER, null:INTEGER), $11)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], i=[LITERAL_AGG(true)])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "IN", - "operand" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], "query" : { "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 16, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "CASE" + } ] } } } - } + }, + "target" : [ { + "column" : 10, + "type" : "INTEGER" + } ] } }, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "CASE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "INTEGER", "operand" : [ { - "column" : 9, - "type" : "BIGINT" - }, { - "operator" : "0", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "false", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "IS NULL", - "operand" : [ { - "operator" : "CASE", + "operator" : "true" + }, { + "type" : "INTEGER", "operand" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], + "column" : 7, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "IS NOT NULL", - "operand" : [ { - "column" : 12, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "<", - "operand" : [ { - "column" : 10, - "type" : "BIGINT" + "operator" : "CAST" }, { - "column" : 9, - "type" : "BIGINT" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" } ], - "type" : "BOOLEAN" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "false", - "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "CASE" } ], - "type" : "BOOLEAN" - } ], + "operator" : "IN" + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "INTEGER" + "operator" : "CASE" }, { "column" : 11, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } - } - } ] - } - } - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false }, { - "column" : 1, - "type" : "BOOLEAN" + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "CASE" + } ] } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ] } } } - }, { - "aggregate" : { - "function" : [ ], + } + } + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "LITERAL_AGG", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 3, + "column" : 0, "type" : "INTEGER" }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "CAST" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + } ], + "operator" : "CASE" + } ] } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ] } - } ] + } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "CAST" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + } ], + "operator" : "CASE" + } ], + "operator" : "IS NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 12, + "type" : "BOOLEAN" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "column" : 9, + "type" : "BIGINT" + } ], + "operator" : "<" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + } ], + "operator" : "CASE" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], D=[IN(CASE(true, CAST($7):INTEGER, null:INTEGER), {\nLogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], D=[CASE(=($9, 0), false, IS NULL(CASE(true, CAST($7):INTEGER, null:INTEGER)), null:BOOLEAN, IS NOT NULL($12), true, <($10, $9), null:BOOLEAN, false)])\n LogicalJoin(condition=[=(CASE(true, CAST($7):INTEGER, null:INTEGER), $11)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$1], i=[true])\n LogicalFilter(condition=[<($0, 20)])\n LogicalProject(EMPNO=[$0], DEPTNO=[CASE(true, CAST($7):INTEGER, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExpandProjectInWithTwoSubQueries.json b/tests/calcite/testExpandProjectInWithTwoSubQueries.json new file mode 100644 index 0000000..eb92285 --- /dev/null +++ b/tests/calcite/testExpandProjectInWithTwoSubQueries.json @@ -0,0 +1,443 @@ +{ + "help" : [ "LogicalProject(EMPNO=[$0], EXPR$1=[OR(IN($7, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($1, 'dept1')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n}), IN($7, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($1, 'dept2')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n}))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(EMPNO=[$0], EXPR$1=[OR(CASE(=($9, 0), false, IS NULL($7), null:BOOLEAN, IS NOT NULL($12), true, <($10, $9), null:BOOLEAN, false), CASE(=($13, 0), false, IS NULL($7), null:BOOLEAN, IS NOT NULL($16), true, <($14, $13), null:BOOLEAN, false))])\n LogicalJoin(condition=[=($7, $15)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($1, 'dept1')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n LogicalProject(DEPTNO=[$0], i=[true])\n LogicalFilter(condition=[=($1, 'dept1')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n LogicalAggregate(group=[{}], c=[COUNT()], ck=[COUNT($0)])\n LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($1, 'dept2')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n LogicalProject(DEPTNO=[$0], i=[true])\n LogicalFilter(condition=[=($1, 'dept2')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n" ], + "schemas" : [ { + "types" : [ "INTEGER", "VARCHAR" ], + "nullable" : [ true, true ], + "name" : "CATALOG.SALES.DEPTNULLABLES", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, true, true, true, true, true, true, true, true ], + "name" : "CATALOG.SALES.EMPNULLABLES", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + } ], + "queries" : [ { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "query" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept1'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ] + } + }, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "IN" + }, { + "query" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept2'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ] + } + }, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "IN" + } ], + "operator" : "OR" + } ] + } + }, { + "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, + "left" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, + "left" : { + "scan" : 1 + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept1'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + } + } + }, + "kind" : "LEFT", + "right" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept1'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] + } + } + } + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept2'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + } + } + }, + "kind" : "LEFT", + "right" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept2'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 12, + "type" : "BOOLEAN" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "column" : 9, + "type" : "BIGINT" + } ], + "operator" : "<" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + } ], + "operator" : "CASE" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 13, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 16, + "type" : "BOOLEAN" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 14, + "type" : "BIGINT" + }, { + "column" : 13, + "type" : "BIGINT" + } ], + "operator" : "<" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + } ], + "operator" : "CASE" + } ], + "operator" : "OR" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testExpandProjectScalar.json b/tests/calcite/testExpandProjectScalar.json index cb51619..429eb1b 100644 --- a/tests/calcite/testExpandProjectScalar.json +++ b/tests/calcite/testExpandProjectScalar.json @@ -1,161 +1,118 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], D=[$SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], D=[$9])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "$SCALAR_QUERY", - "operand" : [ ], "query" : { "project" : { - "target" : [ { - "column" : 16, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 16, + "type" : "INTEGER" + } ] } }, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "type" : "INTEGER", + "operand" : [ ], + "operator" : "$SCALAR_QUERY" + } ] } }, { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SINGLE_VALUE", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SINGLE_VALUE", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "<" }, "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } - } ] + } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], D=[$SCALAR_QUERY({\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], D=[$9])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($0, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExpandWhereComparisonCorrelated.json b/tests/calcite/testExpandWhereComparisonCorrelated.json index 19a4f51..e8a6ac6 100644 --- a/tests/calcite/testExpandWhereComparisonCorrelated.json +++ b/tests/calcite/testExpandWhereComparisonCorrelated.json @@ -1,43 +1,122 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=($5, $SCALAR_QUERY({\nLogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(SAL=[$5])\n LogicalFilter(condition=[=($0, $cor0.EMPNO)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($5, $9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(SAL=[$5])\n LogicalFilter(condition=[=($0, $cor0.EMPNO)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "$SCALAR_QUERY", - "operand" : [ ], "query" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 14, + "type" : "INTEGER" + } ] + } + } + } + }, + "type" : "INTEGER", + "operand" : [ ], + "operator" : "$SCALAR_QUERY" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + }, { + "project" : { + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "source" : { + "correlate" : { + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], "source" : { "project" : { - "target" : [ { - "column" : 14, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" @@ -45,85 +124,25 @@ "column" : 0, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" }, - "source" : { - "project" : { - "target" : [ { - "column" : 14, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } + "target" : [ { + "column" : 14, + "type" : "INTEGER" + } ] } } } - } ] + } } - }, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + } + } }, - "source" : { - "scan" : 0 - } - } - } - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { "target" : [ { "column" : 0, "type" : "INTEGER" @@ -151,112 +170,13 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "correlate" : [ { - "scan" : 0 - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 14, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 14, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - } ] - } - } - } + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=($5, $SCALAR_QUERY({\nLogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(SAL=[$5])\n LogicalFilter(condition=[=($0, $cor0.EMPNO)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($5, $9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{0}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], EXPR$0=[MAX($0)])\n LogicalProject(SAL=[$5])\n LogicalFilter(condition=[=($0, $cor0.EMPNO)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExpressionSimplification1.json b/tests/calcite/testExpressionSimplification1.json index 8c311bf..66b891b 100644 --- a/tests/calcite/testExpressionSimplification1.json +++ b/tests/calcite/testExpressionSimplification1.json @@ -1,14 +1,49 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(<>($1, ''), <>($1, '3'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[SEARCH($1, Sarg[(-∞..'':VARCHAR(20)), ('':VARCHAR(20)..'3':VARCHAR(20)), ('3':VARCHAR(20)..+∞)]:VARCHAR(20))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1''" + } ], + "operator" : "<>" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'3'" + } ], + "operator" : "<>" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -36,44 +71,29 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<>", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1''", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "VARCHAR" }, { - "operator" : "<>", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'3'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "Sarg[(-∞.._ISO-8859-1''), (_ISO-8859-1''.._ISO-8859-1'3'), (_ISO-8859-1'3'..+∞)]" } ], - "type" : "BOOLEAN" + "operator" : "SEARCH" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -101,27 +121,7 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "SEARCH", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "Sarg[(-∞.._ISO-8859-1''), (_ISO-8859-1''.._ISO-8859-1'3'), (_ISO-8859-1'3'..+∞)]", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(<>($1, ''), <>($1, '3'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[SEARCH($1, Sarg[(-∞..'':VARCHAR(20)), ('':VARCHAR(20)..'3':VARCHAR(20)), ('3':VARCHAR(20)..+∞)]:VARCHAR(20))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExpressionSimplification2.json b/tests/calcite/testExpressionSimplification2.json index 2803e82..37a1f1b 100644 --- a/tests/calcite/testExpressionSimplification2.json +++ b/tests/calcite/testExpressionSimplification2.json @@ -1,109 +1,79 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(OR(<($1, ''), >($1, '')), OR(<($1, '3'), >($1, '3')))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[SEARCH($1, Sarg[(-∞..'':CHAR(1)), ('':CHAR(1)..'3'), ('3'..+∞)]:CHAR(1))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1''", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "_ISO-8859-1''" } ], - "type" : "BOOLEAN" + "operator" : "<" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1''", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "_ISO-8859-1''" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'3'", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "_ISO-8859-1'3'" } ], - "type" : "BOOLEAN" + "operator" : "<" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'3'", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "_ISO-8859-1'3'" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "OR" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -131,27 +101,57 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "SEARCH", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "Sarg[(-∞.._ISO-8859-1''), (_ISO-8859-1''.._ISO-8859-1'3'), (_ISO-8859-1'3'..+∞)]", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "Sarg[(-∞.._ISO-8859-1''), (_ISO-8859-1''.._ISO-8859-1'3'), (_ISO-8859-1'3'..+∞)]" } ], - "type" : "BOOLEAN" + "operator" : "SEARCH" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(OR(<($1, ''), >($1, '')), OR(<($1, '3'), >($1, '3')))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[SEARCH($1, Sarg[(-∞..'':CHAR(1)), ('':CHAR(1)..'3'), ('3'..+∞)]:CHAR(1))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExtractJoinFilterRule.json b/tests/calcite/testExtractJoinFilterRule.json index 7d3dda4..32825ae 100644 --- a/tests/calcite/testExtractJoinFilterRule.json +++ b/tests/calcite/testExtractJoinFilterRule.json @@ -1,31 +1,26 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[=($7, $9)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -33,28 +28,29 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -62,27 +58,31 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[=($7, $9)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExtractYearMonthToRange.json b/tests/calcite/testExtractYearMonthToRange.json index 42e45c8..51ab6a8 100644 --- a/tests/calcite/testExtractYearMonthToRange.json +++ b/tests/calcite/testExtractYearMonthToRange.json @@ -1,98 +1,65 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[AND(=(EXTRACT(FLAG(YEAR), $9), 2014), =(EXTRACT(FLAG(MONTH), $9), 4))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[SEARCH($9, Sarg[[2014-04-01..2014-05-01)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n" ], "schemas" : [ { - "name" : "EMP_B", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER", "BIRTHDATE" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN", "DATE" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP_B", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER", "BIRTHDATE" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "DATE" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "EXTRACT", + "type" : "BIGINT", "operand" : [ { - "operator" : "YEAR", + "type" : "SYMBOL", "operand" : [ ], - "type" : "SYMBOL" + "operator" : "YEAR" }, { "column" : 9, "type" : "DATE" } ], - "type" : "BIGINT" + "operator" : "EXTRACT" }, { - "operator" : "2014", + "type" : "BIGINT", "operand" : [ ], - "type" : "BIGINT" + "operator" : "2014" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "EXTRACT", + "type" : "BIGINT", "operand" : [ { - "operator" : "MONTH", + "type" : "SYMBOL", "operand" : [ ], - "type" : "SYMBOL" + "operator" : "MONTH" }, { "column" : 9, "type" : "DATE" } ], - "type" : "BIGINT" + "operator" : "EXTRACT" }, { - "operator" : "4", + "type" : "BIGINT", "operand" : [ ], - "type" : "BIGINT" + "operator" : "4" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -123,27 +90,60 @@ }, { "column" : 9, "type" : "DATE" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "SEARCH", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "DATE" }, { - "operator" : "Sarg[[2014-04-01..2014-05-01)]", + "type" : "DATE", "operand" : [ ], - "type" : "DATE" + "operator" : "Sarg[[2014-04-01..2014-05-01)]" } ], - "type" : "BOOLEAN" + "operator" : "SEARCH" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "DATE" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[AND(=(EXTRACT(FLAG(YEAR), $9), 2014), =(EXTRACT(FLAG(MONTH), $9), 4))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[SEARCH($9, Sarg[[2014-04-01..2014-05-01)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testExtractYearToRange.json b/tests/calcite/testExtractYearToRange.json index 4e89ba6..4f1c158 100644 --- a/tests/calcite/testExtractYearToRange.json +++ b/tests/calcite/testExtractYearToRange.json @@ -1,14 +1,42 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[=(EXTRACT(FLAG(YEAR), $9), 2014)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[SEARCH($9, Sarg[[2014-01-01..2015-01-01)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n" ], "schemas" : [ { - "name" : "EMP_B", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER", "BIRTHDATE" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN", "DATE" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP_B", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER", "BIRTHDATE" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BIGINT", + "operand" : [ { + "type" : "SYMBOL", + "operand" : [ ], + "operator" : "YEAR" + }, { + "column" : 9, + "type" : "DATE" + } ], + "operator" : "EXTRACT" + }, { + "type" : "BIGINT", + "operand" : [ ], + "operator" : "2014" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -39,37 +67,29 @@ }, { "column" : 9, "type" : "DATE" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "EXTRACT", - "operand" : [ { - "operator" : "YEAR", - "operand" : [ ], - "type" : "SYMBOL" - }, { - "column" : 9, - "type" : "DATE" - } ], - "type" : "BIGINT" + "column" : 9, + "type" : "DATE" }, { - "operator" : "2014", + "type" : "DATE", "operand" : [ ], - "type" : "BIGINT" + "operator" : "Sarg[[2014-01-01..2015-01-01)]" } ], - "type" : "BOOLEAN" + "operator" : "SEARCH" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -100,27 +120,7 @@ }, { "column" : 9, "type" : "DATE" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "SEARCH", - "operand" : [ { - "column" : 9, - "type" : "DATE" - }, { - "operator" : "Sarg[[2014-01-01..2015-01-01)]", - "operand" : [ ], - "type" : "DATE" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[=(EXTRACT(FLAG(YEAR), $9), 2014)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], BIRTHDATE=[$9])\n LogicalFilter(condition=[SEARCH($9, Sarg[[2014-01-01..2015-01-01)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP_B]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testFilterJoinRuleAndIsNotNull.json b/tests/calcite/testFilterJoinRuleAndIsNotNull.json index 808b5dd..124c7ac 100644 --- a/tests/calcite/testFilterJoinRuleAndIsNotNull.json +++ b/tests/calcite/testFilterJoinRuleAndIsNotNull.json @@ -1,81 +1,47 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalFilter(condition=[AND(IS NOT NULL($9), IS NOT NULL($10))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[CAST($9):INTEGER], NAME=[CAST($10):VARCHAR(10)])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -83,21 +49,19 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "scan" : 1 } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -131,9 +95,34 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "scan" : 1 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -162,45 +151,56 @@ "column" : 8, "type" : "BOOLEAN" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 9, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "VARCHAR", "operand" : [ { "column" : 10, "type" : "VARCHAR" } ], - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } + "operator" : "CAST" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalFilter(condition=[AND(IS NOT NULL($9), IS NOT NULL($10))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[CAST($9):INTEGER], NAME=[CAST($10):VARCHAR(10)])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testFilterJoinRuleOrIsNotNull.json b/tests/calcite/testFilterJoinRuleOrIsNotNull.json index bd5adb8..0695a10 100644 --- a/tests/calcite/testFilterJoinRuleOrIsNotNull.json +++ b/tests/calcite/testFilterJoinRuleOrIsNotNull.json @@ -1,81 +1,47 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalFilter(condition=[OR(IS NOT NULL($9), IS NOT NULL($10))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[CAST($9):INTEGER], NAME=[CAST($10):VARCHAR(10)])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -83,21 +49,19 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "scan" : 1 } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -131,9 +95,34 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "scan" : 1 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -162,45 +151,56 @@ "column" : 8, "type" : "BOOLEAN" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 9, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "VARCHAR", "operand" : [ { "column" : 10, "type" : "VARCHAR" } ], - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } + "operator" : "CAST" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalFilter(condition=[OR(IS NOT NULL($9), IS NOT NULL($10))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[CAST($9):INTEGER], NAME=[CAST($10):VARCHAR(10)])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testFilterProjectTranspose.json b/tests/calcite/testFilterProjectTranspose.json index fe0e4f5..1720930 100644 --- a/tests/calcite/testFilterProjectTranspose.json +++ b/tests/calcite/testFilterProjectTranspose.json @@ -1,315 +1,197 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalProject(TWICEDEPTNO=[*($0, 2)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalProject(TWICEDEPTNO=[*($0, 2)])\n LogicalFilter(condition=[=($cor0.DEPTNO, *($0, 2))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { - "correlate" : [ { - "scan" : 0 - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "*", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 9, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, + "correlate" : { + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, "type" : "BOOLEAN" } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "*", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } + "operator" : "=" + }, + "source" : { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ], + "operator" : "*" + } ] } } } - } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] } } - } ] + } } - } ] + } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { - "correlate" : [ { - "scan" : 0 - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "*", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 9, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, + "correlate" : { + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, "type" : "BOOLEAN" } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "*", + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", "operand" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "INTEGER" + "operator" : "*" } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } + "operator" : "=" + }, + "source" : { + "scan" : 1 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ], + "operator" : "*" + } ] } - } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] } } - } ] + } } - } ] + } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalProject(TWICEDEPTNO=[*($0, 2)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalProject(TWICEDEPTNO=[*($0, 2)])\n LogicalFilter(condition=[=($cor0.DEPTNO, *($0, 2))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testFilterRemoveIsNotDistinctFromRule.json b/tests/calcite/testFilterRemoveIsNotDistinctFromRule.json index a8056cd..46d2b37 100644 --- a/tests/calcite/testFilterRemoveIsNotDistinctFromRule.json +++ b/tests/calcite/testFilterRemoveIsNotDistinctFromRule.json @@ -1,25 +1,26 @@ { + "help" : [ "LogicalFilter(condition=[IS NOT DISTINCT FROM($7, 20)])\n LogicalTableScan(table=[[scott, EMP]])\n", "LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[scott, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true, true, true, true, true, true ], + "name" : "scott.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "key" : [ [ 0 ], [ 1 ] ] } ], "queries" : [ { "filter" : { "condition" : { - "operator" : "IS NOT DISTINCT FROM", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "TINYINT" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT DISTINCT FROM" }, "source" : { "scan" : 0 @@ -28,21 +29,20 @@ }, { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "TINYINT" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } ], - "help" : [ "LogicalFilter(condition=[IS NOT DISTINCT FROM($7, 20)])\n LogicalTableScan(table=[[scott, EMP]])\n", "LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[scott, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testFlattenUncorrelatedCallBelowEquals.json b/tests/calcite/testFlattenUncorrelatedCallBelowEquals.json index 7fbc096..f50017d 100644 --- a/tests/calcite/testFlattenUncorrelatedCallBelowEquals.json +++ b/tests/calcite/testFlattenUncorrelatedCallBelowEquals.json @@ -1,14 +1,85 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, +($7, 30))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($cor0.DEPTNO, $9)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "operator" : "IS NOT NULL" + }, + "source" : { + "correlate" : { + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 16, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "30" + } ], + "operator" : "+" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] + } + } + } + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -36,127 +107,147 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { - "correlate" : [ { - "scan" : 0 - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "+", + "correlate" : { + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "column" : 16, + "column" : 7, "type" : "INTEGER" }, { - "operator" : "30", - "operand" : [ ], + "column" : 18, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 9, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, + "operator" : "=" + }, + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, "type" : "INTEGER" }, { - "operator" : "+", + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + }, { + "type" : "INTEGER", "operand" : [ { "column" : 16, "type" : "INTEGER" }, { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" } ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 + "operator" : "+" + } ] } } } - } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ] } - } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] } } - } ] + } } - } ] + } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -184,259 +275,7 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "IS NOT NULL", - "operand" : [ { - "column" : 9, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "correlate" : [ { - "scan" : 0 - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 18, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 16, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 9, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 18, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 16, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } - } - } - } - } ] - } - } ] - } - } - } + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, +($7, 30))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($cor0.DEPTNO, $9)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json b/tests/calcite/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json index c7a0e61..cf9c895 100644 --- a/tests/calcite/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json +++ b/tests/calcite/testFlattenUncorrelatedTwoLevelCallBelowEqualsSucceeds.json @@ -1,14 +1,93 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, +(*(2, $7), 30))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($cor0.DEPTNO, $9)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+(*(2, $7), 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "operator" : "IS NOT NULL" + }, + "source" : { + "correlate" : { + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "operator" : "*" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "30" + } ], + "operator" : "+" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] + } + } + } + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -36,143 +115,155 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { - "correlate" : [ { - "scan" : 0 - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "+", + "correlate" : { + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "*", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - } ], + "column" : 7, "type" : "INTEGER" }, { - "operator" : "30", - "operand" : [ ], + "column" : 18, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 9, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, + "operator" : "=" + }, + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, "type" : "INTEGER" }, { - "operator" : "+", + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + }, { + "type" : "INTEGER", "operand" : [ { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" }, { "column" : 16, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" }, { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" } ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 + "operator" : "+" + } ] } } } - } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ] } - } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] } } - } ] + } } - } ] + } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -200,275 +291,7 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "IS NOT NULL", - "operand" : [ { - "column" : 9, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "correlate" : [ { - "scan" : 0 - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 18, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "operator" : "*", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 9, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 18, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "operator" : "*", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } - } - } - } - } ] - } - } ] - } - } - } + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, +(*(2, $7), 30))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($cor0.DEPTNO, $9)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+(*(2, $7), 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testFullOuterJoinSimplificationToInner.json b/tests/calcite/testFullOuterJoinSimplificationToInner.json index 1747456..c3b2b3f 100644 --- a/tests/calcite/testFullOuterJoinSimplificationToInner.json +++ b/tests/calcite/testFullOuterJoinSimplificationToInner.json @@ -1,60 +1,55 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[AND(=($1, 'Charlie'), >($7, 100))])\n LogicalJoin(condition=[=($0, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalProject(DEPTNO=[CAST($0):INTEGER], NAME=[CAST($1):VARCHAR(10)], EMPNO=[CAST($2):INTEGER], ENAME=[CAST($3):VARCHAR(20)], JOB=[CAST($4):VARCHAR(10)], MGR=[$5], HIREDATE=[CAST($6):TIMESTAMP(0)], SAL=[CAST($7):INTEGER], COMM=[CAST($8):INTEGER], DEPTNO0=[CAST($9):INTEGER], SLACKER=[CAST($10):BOOLEAN])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'Charlie'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'Charlie'" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "join" : { - "kind" : "FULL", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -62,159 +57,164 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "FULL", "right" : { "scan" : 1 } } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'Charlie'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "kind" : "INNER", + "right" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "100" + } ], + "operator" : ">" + }, + "source" : { + "scan" : 1 + } + } + } + } + }, "target" : [ { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "VARCHAR", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "VARCHAR", "operand" : [ { "column" : 3, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "VARCHAR", "operand" : [ { "column" : 4, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "CAST" }, { "column" : 5, "type" : "INTEGER" }, { - "operator" : "CAST", + "type" : "TIMESTAMP", "operand" : [ { "column" : 6, "type" : "TIMESTAMP" } ], - "type" : "TIMESTAMP" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 8, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 9, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'Charlie'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "100", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } + "operator" : "CAST" + } ] } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[AND(=($1, 'Charlie'), >($7, 100))])\n LogicalJoin(condition=[=($0, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalProject(DEPTNO=[CAST($0):INTEGER], NAME=[CAST($1):VARCHAR(10)], EMPNO=[CAST($2):INTEGER], ENAME=[CAST($3):VARCHAR(20)], JOB=[CAST($4):VARCHAR(10)], MGR=[$5], HIREDATE=[CAST($6):TIMESTAMP(0)], SAL=[CAST($7):INTEGER], COMM=[CAST($8):INTEGER], DEPTNO0=[CAST($9):INTEGER], SLACKER=[CAST($10):BOOLEAN])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testFullOuterJoinSimplificationToLeftOuter.json b/tests/calcite/testFullOuterJoinSimplificationToLeftOuter.json index 8471efb..f403ede 100644 --- a/tests/calcite/testFullOuterJoinSimplificationToLeftOuter.json +++ b/tests/calcite/testFullOuterJoinSimplificationToLeftOuter.json @@ -1,45 +1,40 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalJoin(condition=[=($0, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalProject(DEPTNO=[CAST($0):INTEGER], NAME=[CAST($1):VARCHAR(10)], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'Charlie'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'Charlie'" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "join" : { - "kind" : "FULL", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -47,42 +42,81 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "FULL", "right" : { "scan" : 1 } } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'Charlie'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "kind" : "LEFT", + "right" : { + "scan" : 1 + } + } + }, "target" : [ { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "VARCHAR", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "CAST" }, { "column" : 2, "type" : "INTEGER" @@ -110,48 +144,14 @@ }, { "column" : 10, "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'Charlie'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "scan" : 1 - } - } - } + } ] } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalJoin(condition=[=($0, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalProject(DEPTNO=[CAST($0):INTEGER], NAME=[CAST($1):VARCHAR(10)], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testFullOuterJoinSimplificationToRightOuter.json b/tests/calcite/testFullOuterJoinSimplificationToRightOuter.json index b11f800..4df6e05 100644 --- a/tests/calcite/testFullOuterJoinSimplificationToRightOuter.json +++ b/tests/calcite/testFullOuterJoinSimplificationToRightOuter.json @@ -1,45 +1,40 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($7, 100)])\n LogicalJoin(condition=[=($0, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[CAST($2):INTEGER], ENAME=[CAST($3):VARCHAR(20)], JOB=[CAST($4):VARCHAR(10)], MGR=[$5], HIREDATE=[CAST($6):TIMESTAMP(0)], SAL=[CAST($7):INTEGER], COMM=[CAST($8):INTEGER], DEPTNO0=[CAST($9):INTEGER], SLACKER=[CAST($10):BOOLEAN])\n LogicalJoin(condition=[=($0, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "join" : { - "kind" : "FULL", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -47,28 +42,67 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "FULL", "right" : { "scan" : 1 } } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "RIGHT", + "right" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "100" + } ], + "operator" : ">" + }, + "source" : { + "scan" : 1 + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -76,106 +110,72 @@ "column" : 1, "type" : "VARCHAR" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "VARCHAR", "operand" : [ { "column" : 3, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "VARCHAR", "operand" : [ { "column" : 4, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "CAST" }, { "column" : 5, "type" : "INTEGER" }, { - "operator" : "CAST", + "type" : "TIMESTAMP", "operand" : [ { "column" : 6, "type" : "TIMESTAMP" } ], - "type" : "TIMESTAMP" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 8, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 9, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "100", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } + "operator" : "CAST" + } ] } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($7, 100)])\n LogicalJoin(condition=[=($0, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[CAST($2):INTEGER], ENAME=[CAST($3):VARCHAR(20)], JOB=[CAST($4):VARCHAR(10)], MGR=[$5], HIREDATE=[CAST($6):TIMESTAMP(0)], SAL=[CAST($7):INTEGER], COMM=[CAST($8):INTEGER], DEPTNO0=[CAST($9):INTEGER], SLACKER=[CAST($10):BOOLEAN])\n LogicalJoin(condition=[=($0, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testGroupByBooleanLiteralSimple.json b/tests/calcite/testGroupByBooleanLiteralSimple.json index 74818a2..fbc5393 100644 --- a/tests/calcite/testGroupByBooleanLiteralSimple.json +++ b/tests/calcite/testGroupByBooleanLiteralSimple.json @@ -1,212 +1,111 @@ { + "help" : [ "LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[true], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[$9], SAL=[$5])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[{ true }]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "BOOLEAN" - } ], "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "AVG", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "column" : 5, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "BOOLEAN" - }, { - "column" : 1, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "BOOLEAN" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "BOOLEAN" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "values" : { - "schema" : [ "BOOLEAN" ], - "content" : [ [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ] ] - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "AVG", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "BOOLEAN" - }, { - "column" : 1, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, + "left" : { + "scan" : 0 }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "BOOLEAN" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "values" : { - "schema" : [ "BOOLEAN" ], - "content" : [ [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ] ] - } - } - } - } + "kind" : "INNER", + "right" : { + "values" : { + "schema" : [ "BOOLEAN" ], + "content" : [ [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] ] } } } - } + }, + "target" : [ { + "column" : 9, + "type" : "BOOLEAN" + }, { + "column" : 5, + "type" : "INTEGER" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[true], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[$9], SAL=[$5])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[{ true }]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testGroupByDateLiteralSimple.json b/tests/calcite/testGroupByDateLiteralSimple.json index f184dce..f973e65 100644 --- a/tests/calcite/testGroupByDateLiteralSimple.json +++ b/tests/calcite/testGroupByDateLiteralSimple.json @@ -1,212 +1,111 @@ { + "help" : [ "LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[2022-01-01], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[$9], SAL=[$5])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[{ 2022-01-01 }]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "DATE" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "DATE" - } ], "source" : { - "project" : { - "target" : [ { - "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", - "operand" : [ ], - "type" : "DATE" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "AVG", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "type" : "DATE", + "operand" : [ ], + "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]" + }, { + "column" : 5, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "DATE" - }, { - "column" : 1, - "type" : "DATE" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", - "operand" : [ ], - "type" : "DATE" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "DATE" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "DATE" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "DATE" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "values" : { - "schema" : [ "DATE" ], - "content" : [ [ { - "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", - "operand" : [ ], - "type" : "DATE" - } ] ] - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "AVG", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "DATE" - }, { - "column" : 1, - "type" : "DATE" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, + "left" : { + "scan" : 0 }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "DATE" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "values" : { - "schema" : [ "DATE" ], - "content" : [ [ { - "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", - "operand" : [ ], - "type" : "DATE" - } ] ] - } - } - } - } + "kind" : "INNER", + "right" : { + "values" : { + "schema" : [ "DATE" ], + "content" : [ [ { + "type" : "DATE", + "operand" : [ ], + "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]" + } ] ] } } } - } + }, + "target" : [ { + "column" : 9, + "type" : "DATE" + }, { + "column" : 5, + "type" : "INTEGER" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[2022-01-01], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1])\n LogicalAggregate(group=[{0}], EXPR$0=[AVG($1)])\n LogicalProject($f0=[$9], SAL=[$5])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[{ 2022-01-01 }]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testGroupByMultipleLiterals.json b/tests/calcite/testGroupByMultipleLiterals.json index c46dbdf..298c80c 100644 --- a/tests/calcite/testGroupByMultipleLiterals.json +++ b/tests/calcite/testGroupByMultipleLiterals.json @@ -1,432 +1,186 @@ { + "help" : [ "LogicalProject(EXPR$0=[$6])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5}], EXPR$0=[AVG($6)])\n LogicalProject($f0=[false], DEPTNO=[$7], $f2=[true], EMPNO=[$0], $f4=['ab'], $f5=[2022-01-01], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$6])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5}], EXPR$0=[AVG($6)])\n LogicalProject($f0=[$9], DEPTNO=[$7], $f2=[$10], EMPNO=[$0], $f4=[$11], $f5=[$12], SAL=[$5])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[{ false, true, 'ab', 2022-01-01 }]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "BOOLEAN" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "CHAR" + }, { + "column" : 5, + "type" : "DATE" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" }, { - "column" : 1, + "column" : 7, "type" : "INTEGER" }, { - "column" : 2, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" }, { - "column" : 3, + "column" : 0, "type" : "INTEGER" }, { - "column" : 4, - "type" : "CHAR" + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'ab'" + }, { + "type" : "DATE", + "operand" : [ ], + "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]" }, { "column" : 5, - "type" : "DATE" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "false", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "_ISO-8859-1'ab'", - "operand" : [ ], - "type" : "CHAR" - }, { - "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", - "operand" : [ ], - "type" : "DATE" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + "type" : "INTEGER" + } ] } + } + } + }, + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ] + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "BOOLEAN" }, { - "aggregate" : { - "function" : [ { - "operator" : "AVG", - "operand" : [ { - "column" : 12, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BOOLEAN" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "CHAR" + }, { + "column" : 5, + "type" : "DATE" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "BOOLEAN" - }, { - "column" : 6, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "CHAR" - }, { - "column" : 10, - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "DATE" - }, { - "column" : 11, - "type" : "DATE" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" }, - "source" : { - "project" : { - "target" : [ { - "operator" : "false", + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "values" : { + "schema" : [ "BOOLEAN", "BOOLEAN", "CHAR", "DATE" ], + "content" : [ [ { + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" - }, { - "column" : 13, - "type" : "INTEGER" + "operator" : "false" }, { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" - }, { - "column" : 6, - "type" : "INTEGER" + "operator" : "true" }, { - "operator" : "_ISO-8859-1'ab'", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "_ISO-8859-1'ab'" }, { - "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", + "type" : "DATE", "operand" : [ ], - "type" : "DATE" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]" + } ] ] } } } - } - } - } ] - } - } - } - }, { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { + }, "target" : [ { - "column" : 0, + "column" : 9, "type" : "BOOLEAN" }, { - "column" : 1, + "column" : 7, "type" : "INTEGER" }, { - "column" : 2, + "column" : 10, "type" : "BOOLEAN" }, { - "column" : 3, + "column" : 0, "type" : "INTEGER" }, { - "column" : 4, + "column" : 11, "type" : "CHAR" }, { - "column" : 5, + "column" : 12, "type" : "DATE" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "BOOLEAN" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "CHAR" - }, { - "column" : 12, - "type" : "DATE" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "values" : { - "schema" : [ "BOOLEAN", "BOOLEAN", "CHAR", "DATE" ], - "content" : [ [ { - "operator" : "false", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'ab'", - "operand" : [ ], - "type" : "CHAR" - }, { - "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", - "operand" : [ ], - "type" : "DATE" - } ] ] - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "AVG", - "operand" : [ { - "column" : 12, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + }, { + "column" : 5, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "BOOLEAN" - }, { - "column" : 6, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "CHAR" - }, { - "column" : 10, - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "DATE" - }, { - "column" : 11, - "type" : "DATE" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 15, - "type" : "BOOLEAN" - }, { - "column" : 13, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "BOOLEAN" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "CHAR" - }, { - "column" : 18, - "type" : "DATE" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "values" : { - "schema" : [ "BOOLEAN", "BOOLEAN", "CHAR", "DATE" ], - "content" : [ [ { - "operator" : "false", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'ab'", - "operand" : [ ], - "type" : "CHAR" - }, { - "operator" : "java.util.GregorianCalendar[time=1640995200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=7,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]", - "operand" : [ ], - "type" : "DATE" - } ] ] - } - } - } - } - } - } - } - } + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$6])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5}], EXPR$0=[AVG($6)])\n LogicalProject($f0=[false], DEPTNO=[$7], $f2=[true], EMPNO=[$0], $f4=['ab'], $f5=[2022-01-01], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$6])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5}], EXPR$0=[AVG($6)])\n LogicalProject($f0=[$9], DEPTNO=[$7], $f2=[$10], EMPNO=[$0], $f4=[$11], $f5=[$12], SAL=[$5])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[{ false, true, 'ab', 2022-01-01 }]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testInferringPredicatesWithNotOperatorInJoinCondition.json b/tests/calcite/testInferringPredicatesWithNotOperatorInJoinCondition.json index e3b33d2..095b7de 100644 --- a/tests/calcite/testInferringPredicatesWithNotOperatorInJoinCondition.json +++ b/tests/calcite/testInferringPredicatesWithNotOperatorInJoinCondition.json @@ -1,76 +1,21 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[AND(=($16, $7), NOT(OR(=($7, 4), =($7, 6))))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[=($16, $7)], joinType=[inner])\n LogicalFilter(condition=[NOT(OR(=($7, 4), =($7, 6)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[SEARCH($7, Sarg[(-∞..4), (4..6), (6..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 16, "type" : "INTEGER" @@ -78,51 +23,49 @@ "column" : 7, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "NOT", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "4", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "4" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "6", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "6" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "OR" } ], - "type" : "BOOLEAN" + "operator" : "NOT" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -177,12 +120,14 @@ }, { "column" : 17, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 16, "type" : "INTEGER" @@ -190,59 +135,60 @@ "column" : 7, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : "NOT", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "4", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "4" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "6", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "6" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "OR" } ], - "type" : "BOOLEAN" + "operator" : "NOT" }, "source" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : "SEARCH", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "Sarg[(-∞..4), (4..6), (6..+∞)]", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "Sarg[(-∞..4), (4..6), (6..+∞)]" } ], - "type" : "BOOLEAN" + "operator" : "SEARCH" }, "source" : { "scan" : 0 @@ -250,8 +196,62 @@ } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[AND(=($16, $7), NOT(OR(=($7, 4), =($7, 6))))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[=($16, $7)], joinType=[inner])\n LogicalFilter(condition=[NOT(OR(=($7, 4), =($7, 6)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[SEARCH($7, Sarg[(-∞..4), (4..6), (6..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testInnerCorrelateWithLeftEmpty.json b/tests/calcite/testInnerCorrelateWithLeftEmpty.json new file mode 100644 index 0000000..82b718e --- /dev/null +++ b/tests/calcite/testInnerCorrelateWithLeftEmpty.json @@ -0,0 +1,45 @@ +{ + "help" : [ "LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{7}])\n LogicalValues(tuples=[[]])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalValues(tuples=[[]])\n" ], + "schemas" : [ { + "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "nullable" : [ false, true, true ], + "name" : "scott.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ] + } ], + "queries" : [ { + "correlate" : { + "left" : { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "content" : [ ] + } + }, + "kind" : "INNER", + "right" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 8, + "type" : "TINYINT" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT", "TINYINT", "VARCHAR", "VARCHAR" ], + "content" : [ ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testInnerCorrelateWithRightEmpty.json b/tests/calcite/testInnerCorrelateWithRightEmpty.json new file mode 100644 index 0000000..8240706 --- /dev/null +++ b/tests/calcite/testInnerCorrelateWithRightEmpty.json @@ -0,0 +1,30 @@ +{ + "help" : [ "LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{7}])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n", "LogicalValues(tuples=[[]])\n" ], + "schemas" : [ { + "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "nullable" : [ false, true, true, true, true, true, true, true ], + "name" : "scott.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "key" : [ [ 0 ], [ 1 ] ] + } ], + "queries" : [ { + "correlate" : { + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "values" : { + "schema" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "content" : [ ] + } + } + } + }, { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT", "TINYINT", "VARCHAR", "VARCHAR" ], + "content" : [ ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testIntersectToDistinct.json b/tests/calcite/testIntersectToDistinct.json index 4f7a541..5f07038 100644 --- a/tests/calcite/testIntersectToDistinct.json +++ b/tests/calcite/testIntersectToDistinct.json @@ -1,16 +1,36 @@ { + "help" : [ "LogicalIntersect(all=[false])\n LogicalIntersect(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($9, 3)])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5, 6, 7, 8}], agg#0=[COUNT()])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5, 6, 7, 8}], agg#0=[COUNT()])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5, 6, 7, 8}], agg#0=[COUNT()])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5, 6, 7, 8}], agg#0=[COUNT()])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "intersect" : [ { "intersect" : [ { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -38,29 +58,29 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -88,30 +108,30 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } } ] }, { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "30" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -139,1702 +159,364 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } } ] }, { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "BIGINT" }, { - "operator" : "3", + "type" : "BIGINT", "operand" : [ ], - "type" : "BIGINT" + "operator" : "3" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 13, - "type" : "TIMESTAMP" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 14, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 16, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" } ] } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "=" + }, "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 13, - "type" : "TIMESTAMP" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 14, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 16, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" } ] } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "30" + } ], + "operator" : "=" + }, "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 13, - "type" : "TIMESTAMP" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 14, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 16, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } + "scan" : 0 } } - } ] - } - } ] - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "VARCHAR" }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "column" : 2, + "type" : "VARCHAR" }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 3, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 13, - "type" : "TIMESTAMP" - } ], - "type" : "BOOLEAN" + "column" : 4, + "type" : "TIMESTAMP" }, { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 14, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 5, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 6, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], + "column" : 8, "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 16, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 18, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 19, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 20, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 21, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 22, - "type" : "TIMESTAMP" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 23, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 24, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 25, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 17, - "type" : "BOOLEAN" - }, { - "column" : 26, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 18, - "type" : "INTEGER" - }, { - "column" : 19, - "type" : "VARCHAR" - }, { - "column" : 20, - "type" : "VARCHAR" - }, { - "column" : 21, - "type" : "INTEGER" - }, { - "column" : 22, - "type" : "TIMESTAMP" - }, { - "column" : 23, - "type" : "INTEGER" - }, { - "column" : 24, - "type" : "INTEGER" - }, { - "column" : 25, - "type" : "INTEGER" - }, { - "column" : 26, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 25, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 16, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 18, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 19, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 20, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 21, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 22, - "type" : "TIMESTAMP" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 23, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 24, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 25, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 17, - "type" : "BOOLEAN" - }, { - "column" : 26, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 18, - "type" : "INTEGER" - }, { - "column" : 19, - "type" : "VARCHAR" - }, { - "column" : 20, - "type" : "VARCHAR" - }, { - "column" : 21, - "type" : "INTEGER" - }, { - "column" : 22, - "type" : "TIMESTAMP" - }, { - "column" : 23, - "type" : "INTEGER" - }, { - "column" : 24, - "type" : "INTEGER" - }, { - "column" : 25, - "type" : "INTEGER" - }, { - "column" : 26, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 25, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 16, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 18, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 19, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 20, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 21, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 22, - "type" : "TIMESTAMP" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 23, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 24, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 25, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 17, - "type" : "BOOLEAN" - }, { - "column" : 26, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 18, - "type" : "INTEGER" - }, { - "column" : 19, - "type" : "VARCHAR" - }, { - "column" : 20, - "type" : "VARCHAR" - }, { - "column" : 21, - "type" : "INTEGER" - }, { - "column" : 22, - "type" : "TIMESTAMP" - }, { - "column" : 23, - "type" : "INTEGER" - }, { - "column" : 24, - "type" : "INTEGER" - }, { - "column" : 25, - "type" : "INTEGER" - }, { - "column" : 26, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 25, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } } ] } } } - } - } ] + } ] + } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalIntersect(all=[false])\n LogicalIntersect(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($9, 3)])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5, 6, 7, 8}], agg#0=[COUNT()])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5, 6, 7, 8}], agg#0=[COUNT()])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5, 6, 7, 8}], agg#0=[COUNT()])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1, 2, 3, 4, 5, 6, 7, 8}], agg#0=[COUNT()])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json b/tests/calcite/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json index 8b4799d..d64785c 100644 --- a/tests/calcite/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json +++ b/tests/calcite/testJoinAssociateRuleWithBottomAlwaysTrueConditionAllowed.json @@ -1,31 +1,31 @@ { + "help" : [ "LogicalJoin(condition=[=($2, $12)], joinType=[inner])\n LogicalJoin(condition=[=($7, $8)], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, BONUS]])\n", "LogicalJoin(condition=[AND(=($2, $12), =($7, $8))], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, BONUS]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true, true, true, true, true, true ], + "name" : "scott.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "key" : [ [ 0 ], [ 1 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "DNAME", "LOC" ], "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ], [ 2 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true ], + "name" : "scott.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ] }, { - "name" : "BONUS", - "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], "types" : [ "VARCHAR", "VARCHAR", "DECIMAL", "DECIMAL" ], - "strategy" : [ "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ], [ 2 ], [ 3 ] ], - "foreign" : [ ] + "nullable" : [ true, true, true, true ], + "name" : "scott.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ], [ 3 ] ] } ], "queries" : [ { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "VARCHAR" @@ -33,13 +33,12 @@ "column" : 12, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "TINYINT" @@ -47,27 +46,28 @@ "column" : 8, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } }, + "kind" : "INNER", "right" : { "scan" : 2 } } }, { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "VARCHAR" @@ -75,9 +75,9 @@ "column" : 12, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "TINYINT" @@ -85,30 +85,30 @@ "column" : 8, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 1 }, + "kind" : "INNER", "right" : { "scan" : 2 } } } } - } ], - "help" : [ "LogicalJoin(condition=[=($2, $12)], joinType=[inner])\n LogicalJoin(condition=[=($7, $8)], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, BONUS]])\n", "LogicalJoin(condition=[AND(=($2, $12), =($7, $8))], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, BONUS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json b/tests/calcite/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json index 679d72e..f5acb23 100644 --- a/tests/calcite/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json +++ b/tests/calcite/testJoinAssociateRuleWithTopAlwaysTrueConditionAllowed.json @@ -1,31 +1,31 @@ { + "help" : [ "LogicalJoin(condition=[=($7, $12)], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, BONUS]])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalJoin(condition=[=($7, $12)], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, BONUS]])\n LogicalTableScan(table=[[scott, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true, true, true, true, true, true ], + "name" : "scott.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "key" : [ [ 0 ], [ 1 ] ] }, { - "name" : "BONUS", - "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], "types" : [ "VARCHAR", "VARCHAR", "DECIMAL", "DECIMAL" ], - "strategy" : [ "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ], [ 2 ], [ 3 ] ], - "foreign" : [ ] + "nullable" : [ true, true, true, true ], + "name" : "scott.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ], [ 3 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "DNAME", "LOC" ], "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ], [ 2 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true ], + "name" : "scott.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ] } ], "queries" : [ { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "TINYINT" @@ -33,33 +33,33 @@ "column" : 12, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } }, + "kind" : "INNER", "right" : { "scan" : 2 } } }, { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "TINYINT" @@ -67,28 +67,28 @@ "column" : 12, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 1 }, + "kind" : "INNER", "right" : { "scan" : 2 } } } } - } ], - "help" : [ "LogicalJoin(condition=[=($7, $12)], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, BONUS]])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalJoin(condition=[=($7, $12)], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, BONUS]])\n LogicalTableScan(table=[[scott, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json b/tests/calcite/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json index 94d798a..54d67e0 100644 --- a/tests/calcite/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json +++ b/tests/calcite/testJoinCommuteRuleWithAlwaysTrueConditionAllowed.json @@ -1,36 +1,53 @@ { + "help" : [ "LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(EMPNO=[$3], ENAME=[$4], JOB=[$5], MGR=[$6], HIREDATE=[$7], SAL=[$8], COMM=[$9], DEPTNO=[$10], DEPTNO0=[$0], DNAME=[$1], LOC=[$2])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true, true, true, true, true, true ], + "name" : "scott.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "key" : [ [ 0 ], [ 1 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "DNAME", "LOC" ], "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ], [ 2 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true ], + "name" : "scott.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ] } ], "queries" : [ { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } }, { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, + "left" : { + "scan" : 1 + }, + "kind" : "INNER", + "right" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 3, "type" : "SMALLINT" @@ -64,24 +81,7 @@ }, { "column" : 2, "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 1 - }, - "right" : { - "scan" : 0 - } - } - } + } ] } - } ], - "help" : [ "LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(EMPNO=[$3], ENAME=[$4], JOB=[$5], MGR=[$6], HIREDATE=[$7], SAL=[$8], COMM=[$9], DEPTNO=[$10], DEPTNO0=[$0], DNAME=[$1], LOC=[$2])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testJoinConditionPushdown1.json b/tests/calcite/testJoinConditionPushdown1.json index 8f5b58a..3fa9c63 100644 --- a/tests/calcite/testJoinConditionPushdown1.json +++ b/tests/calcite/testJoinConditionPushdown1.json @@ -1,88 +1,28 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17], DEPTNO1=[$18], NAME=[$19])\n LogicalFilter(condition=[AND(=($7, $18), =($16, $18))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17], DEPTNO1=[$18], NAME=[$19])\n LogicalJoin(condition=[=($7, $18)], joinType=[inner])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - }, { - "column" : 18, - "type" : "INTEGER" - }, { - "column" : 19, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -90,9 +30,9 @@ "column" : 18, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 16, "type" : "INTEGER" @@ -100,44 +40,41 @@ "column" : 18, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "scan" : 1 } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -198,12 +135,14 @@ }, { "column" : 19, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -211,13 +150,12 @@ "column" : 18, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -225,22 +163,84 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + }, { + "column" : 18, + "type" : "INTEGER" + }, { + "column" : 19, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17], DEPTNO1=[$18], NAME=[$19])\n LogicalFilter(condition=[AND(=($7, $18), =($16, $18))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17], DEPTNO1=[$18], NAME=[$19])\n LogicalJoin(condition=[=($7, $18)], joinType=[inner])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testJoinConditionPushdown2.json b/tests/calcite/testJoinConditionPushdown2.json index 87947c4..bd1f13a 100644 --- a/tests/calcite/testJoinConditionPushdown2.json +++ b/tests/calcite/testJoinConditionPushdown2.json @@ -1,61 +1,28 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalFilter(condition=[AND(=($7, $9), =($0, $9))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalFilter(condition=[=($7, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -63,9 +30,9 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -73,31 +40,28 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -131,12 +95,14 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -144,12 +110,12 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -157,19 +123,53 @@ "column" : 0, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalFilter(condition=[AND(=($7, $9), =($0, $9))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalFilter(condition=[=($7, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testJoinConditionPushdown4.json b/tests/calcite/testJoinConditionPushdown4.json index aa0adf9..34df359 100644 --- a/tests/calcite/testJoinConditionPushdown4.json +++ b/tests/calcite/testJoinConditionPushdown4.json @@ -1,32 +1,28 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[AND(=($0, $2), =($0, $3))], joinType=[semi])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalJoin(condition=[=($7, $8)], joinType=[semi])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalFilter(condition=[=($0, $1)])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true, true, true, true, true, true ], + "name" : "scott.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "key" : [ [ 0 ], [ 1 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "DNAME", "LOC" ], "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ], [ 2 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true ], + "name" : "scott.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "TINYINT" - } ], "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "TINYINT" @@ -34,9 +30,9 @@ "column" : 2, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "TINYINT" @@ -44,61 +40,54 @@ "column" : 3, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 7, "type" : "TINYINT" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } }, + "kind" : "SEMI", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "TINYINT" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "TINYINT" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 7, - "type" : "TINYINT" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "TINYINT" @@ -106,15 +95,16 @@ "column" : 8, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "TINYINT" @@ -122,29 +112,39 @@ "column" : 1, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "TINYINT" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } + } ] } } } } } - } + }, + "target" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "TINYINT" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[AND(=($0, $2), =($0, $3))], joinType=[semi])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalJoin(condition=[=($7, $8)], joinType=[semi])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalFilter(condition=[=($0, $1)])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testJoinConditionPushdown6.json b/tests/calcite/testJoinConditionPushdown6.json index 92c4092..004a944 100644 --- a/tests/calcite/testJoinConditionPushdown6.json +++ b/tests/calcite/testJoinConditionPushdown6.json @@ -1,62 +1,28 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[AND(=($7, $9), =($0, $9))], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalFilter(condition=[=($7, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "RIGHT", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -64,9 +30,9 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -74,21 +40,19 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "RIGHT", "right" : { "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -122,12 +86,14 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "RIGHT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -135,12 +101,12 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -148,19 +114,53 @@ "column" : 0, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } }, + "kind" : "RIGHT", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[AND(=($7, $9), =($0, $9))], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalFilter(condition=[=($7, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testJoinDeriveIsNotNullFilterRule1.json b/tests/calcite/testJoinDeriveIsNotNullFilterRule1.json index 4dec753..75b32c9 100644 --- a/tests/calcite/testJoinDeriveIsNotNullFilterRule1.json +++ b/tests/calcite/testJoinDeriveIsNotNullFilterRule1.json @@ -1,23 +1,19 @@ { + "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($3, $12)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($3, $12)], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" @@ -25,28 +21,28 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" @@ -54,32 +50,33 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { "scan" : 0 @@ -87,8 +84,11 @@ } } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($3, $12)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($3, $12)], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testJoinDeriveIsNotNullFilterRule12.json b/tests/calcite/testJoinDeriveIsNotNullFilterRule12.json index d70a00c..033160e 100644 --- a/tests/calcite/testJoinDeriveIsNotNullFilterRule12.json +++ b/tests/calcite/testJoinDeriveIsNotNullFilterRule12.json @@ -1,25 +1,21 @@ { + "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[AND(=($1, $10), IS NOT DISTINCT FROM($3, $12))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[AND(=($1, $10), IS NOT DISTINCT FROM($3, $12))], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ], "schemas" : [ { - "name" : "EMPNULLABLES", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true, true, true, true, true, true, true ], + "name" : "CATALOG.SALES.EMPNULLABLES", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -27,9 +23,9 @@ "column" : 10, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "IS NOT DISTINCT FROM", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" @@ -37,32 +33,32 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT DISTINCT FROM" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -70,9 +66,9 @@ "column" : 10, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "IS NOT DISTINCT FROM", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" @@ -80,34 +76,35 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT DISTINCT FROM" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { "scan" : 0 @@ -115,8 +112,11 @@ } } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[AND(=($1, $10), IS NOT DISTINCT FROM($3, $12))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[AND(=($1, $10), IS NOT DISTINCT FROM($3, $12))], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testJoinDeriveIsNotNullFilterRule15.json b/tests/calcite/testJoinDeriveIsNotNullFilterRule15.json new file mode 100644 index 0000000..d38aa4f --- /dev/null +++ b/tests/calcite/testJoinDeriveIsNotNullFilterRule15.json @@ -0,0 +1,120 @@ +{ + "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=(CASE(=($1, $10), null:VARCHAR(20), $1), 'abc')], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=(CASE(=($1, $10), null:VARCHAR(20), $1), 'abc')], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ], + "schemas" : [ { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, true, true, true, true, true, true, true, true ], + "name" : "CATALOG.SALES.EMPNULLABLES", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + } ], + "queries" : [ { + "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "VARCHAR", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "NULL" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "CASE" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'abc'" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] + } + }, { + "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "VARCHAR", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "NULL" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "CASE" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'abc'" + } ], + "operator" : "=" + }, + "left" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "IS NOT NULL" + }, + "source" : { + "scan" : 0 + } + } + }, + "kind" : "INNER", + "right" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testJoinDeriveIsNotNullFilterRule2.json b/tests/calcite/testJoinDeriveIsNotNullFilterRule2.json index 8dca101..de81c4f 100644 --- a/tests/calcite/testJoinDeriveIsNotNullFilterRule2.json +++ b/tests/calcite/testJoinDeriveIsNotNullFilterRule2.json @@ -1,23 +1,19 @@ { + "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($3, $12)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($3, $12)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" @@ -25,10 +21,25 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "IS NOT NULL" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -56,41 +67,26 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "IS NOT NULL", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" @@ -98,10 +94,25 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "IS NOT NULL" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -129,33 +140,19 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "IS NOT NULL", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { "scan" : 0 @@ -163,8 +160,11 @@ } } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($3, $12)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($3, $12)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testJoinDeriveIsNotNullFilterRule3.json b/tests/calcite/testJoinDeriveIsNotNullFilterRule3.json index 5680647..682e8d3 100644 --- a/tests/calcite/testJoinDeriveIsNotNullFilterRule3.json +++ b/tests/calcite/testJoinDeriveIsNotNullFilterRule3.json @@ -1,23 +1,19 @@ { + "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[>($3, $12)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[>($3, $12)], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" @@ -25,28 +21,28 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" @@ -54,32 +50,33 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "left" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { "scan" : 0 @@ -87,8 +84,11 @@ } } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[>($3, $12)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[>($3, $12)], joinType=[inner])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testJoinDeriveIsNotNullFilterRule4.json b/tests/calcite/testJoinDeriveIsNotNullFilterRule4.json index 3c59851..aa22a02 100644 --- a/tests/calcite/testJoinDeriveIsNotNullFilterRule4.json +++ b/tests/calcite/testJoinDeriveIsNotNullFilterRule4.json @@ -1,25 +1,21 @@ { + "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[AND(=($1, $10), >($3, $12))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[AND(=($1, $10), >($3, $12))], joinType=[inner])\n LogicalFilter(condition=[AND(IS NOT NULL($1), IS NOT NULL($3))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[AND(IS NOT NULL($1), IS NOT NULL($3))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ], "schemas" : [ { - "name" : "EMPNULLABLES", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true, true, true, true, true, true, true ], + "name" : "CATALOG.SALES.EMPNULLABLES", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -27,9 +23,9 @@ "column" : 10, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" @@ -37,32 +33,32 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -70,9 +66,9 @@ "column" : 10, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" @@ -80,56 +76,57 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 @@ -137,8 +134,11 @@ } } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[AND(=($1, $10), >($3, $12))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[AND(=($1, $10), >($3, $12))], joinType=[inner])\n LogicalFilter(condition=[AND(IS NOT NULL($1), IS NOT NULL($3))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[AND(IS NOT NULL($1), IS NOT NULL($3))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testJoinDeriveIsNotNullFilterRule5.json b/tests/calcite/testJoinDeriveIsNotNullFilterRule5.json index 71df99b..fddb086 100644 --- a/tests/calcite/testJoinDeriveIsNotNullFilterRule5.json +++ b/tests/calcite/testJoinDeriveIsNotNullFilterRule5.json @@ -1,23 +1,19 @@ { + "help" : [ "LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalProject(ENAME=[$1], DEPTNO=[+($7, 1)])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalProject(ENAME=[$1], DEPTNO=[+($7, 1)])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ], "schemas" : [ { - "name" : "EMPNULLABLES", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true, true, true, true, true, true, true ], + "name" : "CATALOG.SALES.EMPNULLABLES", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "VARCHAR" @@ -25,59 +21,59 @@ "column" : 3, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "+" + } ] } }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "VARCHAR" @@ -85,51 +81,52 @@ "column" : 3, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "+" + } ] } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { "scan" : 0 @@ -137,8 +134,11 @@ } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalProject(ENAME=[$1], DEPTNO=[+($7, 1)])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(DEPTNO=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalProject(ENAME=[$1], DEPTNO=[+($7, 1)])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testJoinProjectTranspose1.json b/tests/calcite/testJoinProjectTranspose1.json index 6c14469..109cff4 100644 --- a/tests/calcite/testJoinProjectTranspose1.json +++ b/tests/calcite/testJoinProjectTranspose1.json @@ -1,57 +1,49 @@ { + "help" : [ "LogicalProject(NAME=[$0])\n LogicalJoin(condition=[$1], joinType=[right])\n LogicalProject(NAME=[$1], $f4=[$5])\n LogicalJoin(condition=[$4], joinType=[left])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[>($0, 10)], $f4=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$1])\n LogicalJoin(condition=[>($2, 10)], joinType=[right])\n LogicalJoin(condition=[>($2, 10)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "RIGHT", "condition" : { "column" : 1, "type" : "BOOLEAN" }, "left" : { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "BOOLEAN" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { "column" : 4, "type" : "BOOLEAN" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } }, + "kind" : "LEFT", "right" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -59,101 +51,109 @@ "column" : 1, "type" : "VARCHAR" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + "operator" : ">" + } ] } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "BOOLEAN" + } ] } }, + "kind" : "RIGHT", "right" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ] } }, { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "RIGHT", "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "left" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "scan" : 0 } } }, + "kind" : "RIGHT", "right" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(NAME=[$0])\n LogicalJoin(condition=[$1], joinType=[right])\n LogicalProject(NAME=[$1], $f4=[$5])\n LogicalJoin(condition=[$4], joinType=[left])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[>($0, 10)], $f4=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$1])\n LogicalJoin(condition=[>($2, 10)], joinType=[right])\n LogicalJoin(condition=[>($2, 10)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testJoinProjectTranspose7.json b/tests/calcite/testJoinProjectTranspose7.json index b1ee2fc..71a98c0 100644 --- a/tests/calcite/testJoinProjectTranspose7.json +++ b/tests/calcite/testJoinProjectTranspose7.json @@ -1,29 +1,19 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$2])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$2])\n LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$3])\n LogicalJoin(condition=[=($1, $3)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -31,27 +21,25 @@ "column" : 2, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -61,24 +49,16 @@ }, { "column" : 2, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -86,19 +66,39 @@ "column" : 3, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$2])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$2])\n LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$3])\n LogicalJoin(condition=[=($1, $3)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testJoinProjectTranspose8.json b/tests/calcite/testJoinProjectTranspose8.json index 01debc4..9585464 100644 --- a/tests/calcite/testJoinProjectTranspose8.json +++ b/tests/calcite/testJoinProjectTranspose8.json @@ -1,32 +1,19 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$2], EXPR$1=[$3])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], EXPR$1=[AND(>($0, 10), null)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$2], EXPR$1=[$3])\n LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$3], EXPR$1=[AND(>($2, 10), null)])\n LogicalJoin(condition=[=($1, $3)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "BOOLEAN" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -34,46 +21,44 @@ "column" : 2, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "NULL", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "NULL" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + "operator" : "AND" + } ] } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -86,9 +71,34 @@ }, { "column" : 3, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -99,50 +109,40 @@ "column" : 3, "type" : "VARCHAR" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "NULL", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "NULL" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 0 - } - } - } + "operator" : "AND" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$2], EXPR$1=[$3])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], EXPR$1=[AND(>($0, 10), null)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$2], EXPR$1=[$3])\n LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[$3], EXPR$1=[AND(>($2, 10), null)])\n LogicalJoin(condition=[=($1, $3)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testJoinProjectTransposeWindow.json b/tests/calcite/testJoinProjectTransposeWindow.json index 4f10be1..9c6198d 100644 --- a/tests/calcite/testJoinProjectTransposeWindow.json +++ b/tests/calcite/testJoinProjectTransposeWindow.json @@ -1,32 +1,19 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1], R=[$3], EXPR$1=[$4])\n LogicalJoin(condition=[=($2, $3)], joinType=[inner])\n LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[CAST($1):BIGINT NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(R=[RANK() OVER (ORDER BY $1)], EXPR$1=[+(1, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1], R=[$3], EXPR$1=[$4])\n LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[CAST($1):BIGINT NOT NULL], R=[$2], EXPR$1=[$3])\n LogicalJoin(condition=[=(CAST($1):BIGINT NOT NULL, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(R=[RANK() OVER (ORDER BY $1)], EXPR$1=[+(1, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "BIGINT" - }, { - "column" : 4, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "BIGINT" @@ -34,10 +21,13 @@ "column" : 3, "type" : "BIGINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -45,45 +35,42 @@ "column" : 1, "type" : "VARCHAR" }, { - "operator" : "CAST", + "type" : "BIGINT", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "BIGINT" - } ], - "source" : { - "scan" : 0 - } + "operator" : "CAST" + } ] } }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "error" : "Not implemented: RANK" + "type" : "BIGINT", + "operand" : [ ], + "operator" : "RANK" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "+" + } ] } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -96,77 +83,94 @@ }, { "column" : 4, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BIGINT" - }, { - "column" : 2, - "type" : "BIGINT" - }, { - "column" : 3, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "CAST", + "type" : "BIGINT", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "BIGINT" + "operator" : "CAST" }, { "column" : 2, "type" : "BIGINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "error" : "Not implemented: RANK" + "type" : "BIGINT", + "operand" : [ ], + "operator" : "RANK" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "+" + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 3, + "type" : "INTEGER" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "BIGINT" + }, { + "column" : 4, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1], R=[$3], EXPR$1=[$4])\n LogicalJoin(condition=[=($2, $3)], joinType=[inner])\n LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[CAST($1):BIGINT NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(R=[RANK() OVER (ORDER BY $1)], EXPR$1=[+(1, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1], R=[$3], EXPR$1=[$4])\n LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[CAST($1):BIGINT NOT NULL], R=[$2], EXPR$1=[$3])\n LogicalJoin(condition=[=(CAST($1):BIGINT NOT NULL, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(R=[RANK() OVER (ORDER BY $1)], EXPR$1=[+(1, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testJoinPushTransitivePredicatesRule2.json b/tests/calcite/testJoinPushTransitivePredicatesRule2.json index 2c98457..3d42983 100644 --- a/tests/calcite/testJoinPushTransitivePredicatesRule2.json +++ b/tests/calcite/testJoinPushTransitivePredicatesRule2.json @@ -1,25 +1,21 @@ { + "help" : [ "LogicalProject(SAL=[$5])\n LogicalJoin(condition=[AND(=($5, $11), =($9, $12))], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], SAL0=[$5], $f9=[=($5, 4)])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[=($1, $0)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalProject(SAL=[$5], SAL0=[$8], $f9=[$9])\n LogicalJoin(condition=[OR(=($8, $5), $9)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(SAL=[$5], $f9=[=($5, 4)])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(SAL=[$5])\n LogicalJoin(condition=[AND(=($5, $11), =($9, $12))], joinType=[inner])\n LogicalFilter(condition=[>($5, 1000)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], SAL0=[$5], $f9=[=($5, 4)])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[=($1, $0)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalProject(SAL=[$5], SAL0=[$8], $f9=[$9])\n LogicalJoin(condition=[OR(=($8, $5), $9)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(SAL=[$5], $f9=[=($5, 4)])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ], "schemas" : [ { - "name" : "EMPNULLABLES", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true, true, true, true, true, true, true ], + "name" : "CATALOG.SALES.EMPNULLABLES", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" @@ -27,9 +23,9 @@ "column" : 11, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "BOOLEAN" @@ -37,12 +33,46 @@ "column" : 12, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1000" + } ], + "operator" : ">" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -71,57 +101,24 @@ "column" : 5, "type" : "INTEGER" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "4", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "4" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + "operator" : "=" + } ] } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "INTEGER" @@ -129,595 +126,205 @@ "column" : 0, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BOOLEAN" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "BOOLEAN" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "OR", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "=" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ], + "operator" : "OR" + }, + "left" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1000" + } ], + "operator" : ">" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } }, - "left" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "1000", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1000" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "4" + } ], + "operator" : "=" } ] } } } } } - } + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ] } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" - }, { - "column" : 5, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "OR", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 12, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "TIMESTAMP" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "BOOLEAN" - }, { - "column" : 6, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 12, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - } - } - } - } - } - } - } - } - } ] + } } } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 5, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" @@ -725,9 +332,9 @@ "column" : 11, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "BOOLEAN" @@ -735,26 +342,60 @@ "column" : 12, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "1000", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1000" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1000" + } ], + "operator" : ">" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -783,59 +424,26 @@ "column" : 5, "type" : "INTEGER" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "4", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "4" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + "operator" : "=" + } ] } } } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "INTEGER" @@ -843,582 +451,196 @@ "column" : 0, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "OR", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - } - } - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ ], + "column" : 2, + "type" : "BOOLEAN" + } ], + "function" : [ ], + "source" : { + "project" : { "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 1, + "column" : 8, "type" : "INTEGER" }, { - "column" : 4, + "column" : 5, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" - }, { - "column" : 5, - "type" : "BOOLEAN" - } ], + "column" : 9, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, - "source" : { + "left" : { "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "BOOLEAN" - } ], "source" : { - "join" : { - "kind" : "INNER", + "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 11, + "column" : 7, "type" : "INTEGER" }, { - "column" : 8, - "type" : "INTEGER" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "column" : 12, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { + "type" : "BOOLEAN", + "operand" : [ { "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 6, "type" : "INTEGER" }, { - "column" : 7, - "type" : "TIMESTAMP" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "BOOLEAN" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1000" } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "operator" : ">" + } ], + "operator" : "AND" }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "BOOLEAN" + } ], + "function" : [ ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, "type" : "INTEGER" }, { - "column" : 4, - "type" : "BOOLEAN" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "BOOLEAN" - }, { - "column" : 6, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 12, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1000" + } ], + "operator" : ">" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } } - } + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "4" + } ], + "operator" : "=" + } ] } } } } } - } + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "BOOLEAN" + } ] } - } ] + } } } } } } - } + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(SAL=[$5])\n LogicalJoin(condition=[AND(=($5, $11), =($9, $12))], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], SAL0=[$5], $f9=[=($5, 4)])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[=($1, $0)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalProject(SAL=[$5], SAL0=[$8], $f9=[$9])\n LogicalJoin(condition=[OR(=($8, $5), $9)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(SAL=[$5], $f9=[=($5, 4)])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(SAL=[$5])\n LogicalJoin(condition=[AND(=($5, $11), =($9, $12))], joinType=[inner])\n LogicalFilter(condition=[>($5, 1000)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], SAL0=[$5], $f9=[=($5, 4)])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalFilter(condition=[=($1, $0)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalProject(SAL=[$5], SAL0=[$8], $f9=[$9])\n LogicalJoin(condition=[OR(=($8, $5), $9)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(SAL=[$5], $f9=[=($5, 4)])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testLeftCorrelateWithBothEmpty1.json b/tests/calcite/testLeftCorrelateWithBothEmpty1.json new file mode 100644 index 0000000..c75541e --- /dev/null +++ b/tests/calcite/testLeftCorrelateWithBothEmpty1.json @@ -0,0 +1,67 @@ +{ + "help" : [ "LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalValues(tuples=[[]])\n LogicalValues(tuples=[[]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], DEPTNO0=[null:TINYINT], DNAME=[null:VARCHAR(14)], LOC=[null:VARCHAR(13)])\n LogicalValues(tuples=[[]])\n" ], + "schemas" : [ ], + "queries" : [ { + "correlate" : { + "left" : { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "content" : [ ] + } + }, + "kind" : "LEFT", + "right" : { + "values" : { + "schema" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "content" : [ ] + } + } + } + }, { + "project" : { + "source" : { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "content" : [ ] + } + }, + "target" : [ { + "column" : 0, + "type" : "SMALLINT" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "SMALLINT" + }, { + "column" : 4, + "type" : "DATE" + }, { + "column" : 5, + "type" : "DECIMAL" + }, { + "column" : 6, + "type" : "DECIMAL" + }, { + "column" : 7, + "type" : "TINYINT" + }, { + "type" : "TINYINT", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "NULL" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testLeftCorrelateWithBothEmpty2.json b/tests/calcite/testLeftCorrelateWithBothEmpty2.json new file mode 100644 index 0000000..0f8190c --- /dev/null +++ b/tests/calcite/testLeftCorrelateWithBothEmpty2.json @@ -0,0 +1,26 @@ +{ + "help" : [ "LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalValues(tuples=[[]])\n LogicalValues(tuples=[[]])\n", "LogicalValues(tuples=[[]])\n" ], + "schemas" : [ ], + "queries" : [ { + "correlate" : { + "left" : { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "content" : [ ] + } + }, + "kind" : "LEFT", + "right" : { + "values" : { + "schema" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "content" : [ ] + } + } + } + }, { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT", "TINYINT", "VARCHAR", "VARCHAR" ], + "content" : [ ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testLeftCorrelateWithBothEmpty3.json b/tests/calcite/testLeftCorrelateWithBothEmpty3.json new file mode 100644 index 0000000..c75541e --- /dev/null +++ b/tests/calcite/testLeftCorrelateWithBothEmpty3.json @@ -0,0 +1,67 @@ +{ + "help" : [ "LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalValues(tuples=[[]])\n LogicalValues(tuples=[[]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], DEPTNO0=[null:TINYINT], DNAME=[null:VARCHAR(14)], LOC=[null:VARCHAR(13)])\n LogicalValues(tuples=[[]])\n" ], + "schemas" : [ ], + "queries" : [ { + "correlate" : { + "left" : { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "content" : [ ] + } + }, + "kind" : "LEFT", + "right" : { + "values" : { + "schema" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "content" : [ ] + } + } + } + }, { + "project" : { + "source" : { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "content" : [ ] + } + }, + "target" : [ { + "column" : 0, + "type" : "SMALLINT" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "SMALLINT" + }, { + "column" : 4, + "type" : "DATE" + }, { + "column" : 5, + "type" : "DECIMAL" + }, { + "column" : 6, + "type" : "DECIMAL" + }, { + "column" : 7, + "type" : "TINYINT" + }, { + "type" : "TINYINT", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "NULL" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testLeftCorrelateWithLeftEmpty.json b/tests/calcite/testLeftCorrelateWithLeftEmpty.json new file mode 100644 index 0000000..55449d2 --- /dev/null +++ b/tests/calcite/testLeftCorrelateWithLeftEmpty.json @@ -0,0 +1,45 @@ +{ + "help" : [ "LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalValues(tuples=[[]])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalValues(tuples=[[]])\n" ], + "schemas" : [ { + "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "nullable" : [ false, true, true ], + "name" : "scott.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ] + } ], + "queries" : [ { + "correlate" : { + "left" : { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "content" : [ ] + } + }, + "kind" : "LEFT", + "right" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 8, + "type" : "TINYINT" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT", "TINYINT", "VARCHAR", "VARCHAR" ], + "content" : [ ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testLeftCorrelateWithRightEmpty.json b/tests/calcite/testLeftCorrelateWithRightEmpty.json new file mode 100644 index 0000000..1667d56 --- /dev/null +++ b/tests/calcite/testLeftCorrelateWithRightEmpty.json @@ -0,0 +1,68 @@ +{ + "help" : [ "LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], DEPTNO0=[null:TINYINT], DNAME=[null:VARCHAR(14)], LOC=[null:VARCHAR(13)])\n LogicalTableScan(table=[[scott, EMP]])\n" ], + "schemas" : [ { + "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "nullable" : [ false, true, true, true, true, true, true, true ], + "name" : "scott.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "key" : [ [ 0 ], [ 1 ] ] + } ], + "queries" : [ { + "correlate" : { + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "values" : { + "schema" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "content" : [ ] + } + } + } + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "SMALLINT" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "SMALLINT" + }, { + "column" : 4, + "type" : "DATE" + }, { + "column" : 5, + "type" : "DECIMAL" + }, { + "column" : 6, + "type" : "DECIMAL" + }, { + "column" : 7, + "type" : "TINYINT" + }, { + "type" : "TINYINT", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "NULL" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testLeftEmptyAntiJoin.json b/tests/calcite/testLeftEmptyAntiJoin.json index f0d3483..38d9e60 100644 --- a/tests/calcite/testLeftEmptyAntiJoin.json +++ b/tests/calcite/testLeftEmptyAntiJoin.json @@ -1,23 +1,19 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($7, $8)], joinType=[anti])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "DNAME", "LOC" ], "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ], [ 2 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true ], + "name" : "scott.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "SMALLINT" - } ], "source" : { "join" : { - "kind" : "ANTI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "TINYINT" @@ -25,7 +21,7 @@ "column" : 8, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "values" : { @@ -33,25 +29,29 @@ "content" : [ ] } }, + "kind" : "ANTI", "right" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "SMALLINT" - } ], + } ] + } + }, { + "project" : { "source" : { "values" : { "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], "content" : [ ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "SMALLINT" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($7, $8)], joinType=[anti])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testLeftEmptyFullJoin.json b/tests/calcite/testLeftEmptyFullJoin.json index 8f71bd2..e8a520e 100644 --- a/tests/calcite/testLeftEmptyFullJoin.json +++ b/tests/calcite/testLeftEmptyFullJoin.json @@ -1,60 +1,26 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalProject(EMPNO=[null:INTEGER], ENAME=[null:VARCHAR(20)], JOB=[null:VARCHAR(10)], MGR=[null:INTEGER], HIREDATE=[null:TIMESTAMP(0)], SAL=[null:INTEGER], COMM=[null:INTEGER], DEPTNO=[null:INTEGER], SLACKER=[null:BOOLEAN], DEPTNO0=[CAST($0):INTEGER], NAME=[CAST($1):VARCHAR(10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "FULL", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -62,10 +28,22 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -93,29 +71,15 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "false", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } }, + "kind" : "FULL", "right" : { "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -149,33 +113,102 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "TIMESTAMP", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "INTEGER", "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, + "column" : 0, "type" : "INTEGER" } ], - "type" : "BOOLEAN" - }, - "left" : { - "values" : { - "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "content" : [ ] - } - }, - "right" : { - "scan" : 1 - } + "operator" : "CAST" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testLeftEmptyInnerJoin.json b/tests/calcite/testLeftEmptyInnerJoin.json index a3a1174..9e73941 100644 --- a/tests/calcite/testLeftEmptyInnerJoin.json +++ b/tests/calcite/testLeftEmptyInnerJoin.json @@ -1,60 +1,26 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -62,10 +28,22 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -93,29 +71,15 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "false", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } }, + "kind" : "INNER", "right" : { "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -149,14 +113,50 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "values" : { "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN", "INTEGER", "VARCHAR" ], "content" : [ ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testLeftEmptyLeftJoin.json b/tests/calcite/testLeftEmptyLeftJoin.json index ab20416..79bd576 100644 --- a/tests/calcite/testLeftEmptyLeftJoin.json +++ b/tests/calcite/testLeftEmptyLeftJoin.json @@ -1,60 +1,26 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -62,10 +28,22 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -93,29 +71,15 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "false", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } }, + "kind" : "LEFT", "right" : { "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -149,14 +113,50 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "values" : { "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN", "INTEGER", "VARCHAR" ], "content" : [ ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testLeftEmptyRightJoin.json b/tests/calcite/testLeftEmptyRightJoin.json index 7aee8c3..3f923c9 100644 --- a/tests/calcite/testLeftEmptyRightJoin.json +++ b/tests/calcite/testLeftEmptyRightJoin.json @@ -1,60 +1,26 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalProject(EMPNO=[null:INTEGER], ENAME=[null:VARCHAR(20)], JOB=[null:VARCHAR(10)], MGR=[null:INTEGER], HIREDATE=[null:TIMESTAMP(0)], SAL=[null:INTEGER], COMM=[null:INTEGER], DEPTNO=[null:INTEGER], SLACKER=[null:BOOLEAN], DEPTNO0=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "RIGHT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -62,10 +28,22 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -93,29 +71,15 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "false", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } }, + "kind" : "RIGHT", "right" : { "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -149,33 +113,94 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "values" : { - "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "content" : [ ] - } - }, - "right" : { + "project" : { + "source" : { "scan" : 1 - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "TIMESTAMP", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testLeftEmptySemiJoin.json b/tests/calcite/testLeftEmptySemiJoin.json index 440577f..5efb37d 100644 --- a/tests/calcite/testLeftEmptySemiJoin.json +++ b/tests/calcite/testLeftEmptySemiJoin.json @@ -1,23 +1,19 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($7, $8)], joinType=[semi])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "DNAME", "LOC" ], "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ], [ 2 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true ], + "name" : "scott.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "SMALLINT" - } ], "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "TINYINT" @@ -25,7 +21,7 @@ "column" : 8, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "values" : { @@ -33,25 +29,29 @@ "content" : [ ] } }, + "kind" : "SEMI", "right" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "SMALLINT" - } ], + } ] + } + }, { + "project" : { "source" : { "values" : { "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], "content" : [ ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "SMALLINT" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($7, $8)], joinType=[semi])\n LogicalValues(tuples=[[]])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testLeftOuterJoinSimplificationToInner.json b/tests/calcite/testLeftOuterJoinSimplificationToInner.json index 9f3f5b5..143a3d1 100644 --- a/tests/calcite/testLeftOuterJoinSimplificationToInner.json +++ b/tests/calcite/testLeftOuterJoinSimplificationToInner.json @@ -1,45 +1,40 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($7, 100)])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[CAST($2):INTEGER], ENAME=[CAST($3):VARCHAR(20)], JOB=[CAST($4):VARCHAR(10)], MGR=[$5], HIREDATE=[CAST($6):TIMESTAMP(0)], SAL=[CAST($7):INTEGER], COMM=[CAST($8):INTEGER], DEPTNO0=[CAST($9):INTEGER], SLACKER=[CAST($10):BOOLEAN])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -47,28 +42,67 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "scan" : 1 } } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "100" + } ], + "operator" : ">" + }, + "source" : { + "scan" : 1 + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -76,106 +110,72 @@ "column" : 1, "type" : "VARCHAR" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "VARCHAR", "operand" : [ { "column" : 3, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "VARCHAR", "operand" : [ { "column" : 4, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "CAST" }, { "column" : 5, "type" : "INTEGER" }, { - "operator" : "CAST", + "type" : "TIMESTAMP", "operand" : [ { "column" : 6, "type" : "TIMESTAMP" } ], - "type" : "TIMESTAMP" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 8, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 9, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "100", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } + "operator" : "CAST" + } ] } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($7, 100)])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[CAST($2):INTEGER], ENAME=[CAST($3):VARCHAR(20)], JOB=[CAST($4):VARCHAR(10)], MGR=[$5], HIREDATE=[CAST($6):TIMESTAMP(0)], SAL=[CAST($7):INTEGER], COMM=[CAST($8):INTEGER], DEPTNO0=[CAST($9):INTEGER], SLACKER=[CAST($10):BOOLEAN])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testMaxReuseDistinctAttrWithMixedOptionality.json b/tests/calcite/testMaxReuseDistinctAttrWithMixedOptionality.json index 83b3cd8..29d218c 100644 --- a/tests/calcite/testMaxReuseDistinctAttrWithMixedOptionality.json +++ b/tests/calcite/testMaxReuseDistinctAttrWithMixedOptionality.json @@ -1,244 +1,107 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[MAX($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT($0)], EXPR$2=[MAX($0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : true, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" } ], + "function" : [ ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[MAX($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT($0)], EXPR$2=[MAX($0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testMergeFilter.json b/tests/calcite/testMergeFilter.json index 4572937..e92467d 100644 --- a/tests/calcite/testMergeFilter.json +++ b/tests/calcite/testMergeFilter.json @@ -1,102 +1,102 @@ { + "help" : [ "LogicalProject(NAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$1])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(NAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$1])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testMergeIntersect.json b/tests/calcite/testMergeIntersect.json index 946cf7e..5f2cad9 100644 --- a/tests/calcite/testMergeIntersect.json +++ b/tests/calcite/testMergeIntersect.json @@ -1,16 +1,36 @@ { + "help" : [ "LogicalIntersect(all=[false])\n LogicalIntersect(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalIntersect(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "intersect" : [ { "intersect" : [ { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -38,29 +58,29 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -88,30 +108,30 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } } ] }, { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "30" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -139,31 +159,31 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + } ] + }, { + "intersect" : [ { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - } ] - }, { - "intersect" : [ { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -191,29 +211,29 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -241,29 +261,29 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -291,28 +311,8 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } } ] - } ], - "help" : [ "LogicalIntersect(all=[false])\n LogicalIntersect(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalIntersect(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testMergeJoinFilter.json b/tests/calcite/testMergeJoinFilter.json index 0f3acdc..07d6901 100644 --- a/tests/calcite/testMergeJoinFilter.json +++ b/tests/calcite/testMergeJoinFilter.json @@ -1,58 +1,44 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], ENAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalProject(DEPTNO=[$9], ENAME=[$1])\n LogicalJoin(condition=[AND(=($7, $9), =($9, 10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], ENAME=[$1])\n LogicalProject(DEPTNO=[$9], ENAME=[$1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -60,57 +46,57 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -118,24 +104,25 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 1 @@ -143,10 +130,23 @@ } } } - } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], ENAME=[$1])\n LogicalFilter(condition=[=($0, 10)])\n LogicalProject(DEPTNO=[$9], ENAME=[$1])\n LogicalJoin(condition=[AND(=($7, $9), =($9, 10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], ENAME=[$1])\n LogicalProject(DEPTNO=[$9], ENAME=[$1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testMergeMinus.json b/tests/calcite/testMergeMinus.json index 8e35f6b..68030ad 100644 --- a/tests/calcite/testMergeMinus.json +++ b/tests/calcite/testMergeMinus.json @@ -1,174 +1,36 @@ { + "help" : [ "LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalMinus(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { + "except" : [ { "except" : [ { - "distinct" : { - "except" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - }, { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - } ] - } - }, { - "distinct" : { - "except" : [ { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -196,79 +58,29 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } }, { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -296,29 +108,211 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } } ] - } - } ], - "help" : [ "LogicalMinus(all=[false])\n LogicalMinus(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalMinus(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + }, { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "30" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + } ] + }, { + "except" : [ { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + }, { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + }, { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "30" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + } ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testMergeUnionAll.json b/tests/calcite/testMergeUnionAll.json index aae0f1d..97a3907 100644 --- a/tests/calcite/testMergeUnionAll.json +++ b/tests/calcite/testMergeUnionAll.json @@ -1,16 +1,36 @@ { + "help" : [ "LogicalUnion(all=[true])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "union" : [ { "union" : [ { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -38,29 +58,29 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -88,30 +108,30 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } } ] }, { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "30" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -139,31 +159,31 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + } ] + }, { + "union" : [ { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - } ] - }, { - "union" : [ { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -191,29 +211,29 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -241,29 +261,29 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -291,28 +311,8 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } } ] - } ], - "help" : [ "LogicalUnion(all=[true])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testMergeUnionDistinct.json b/tests/calcite/testMergeUnionDistinct.json index 996e9e8..cebac8c 100644 --- a/tests/calcite/testMergeUnionDistinct.json +++ b/tests/calcite/testMergeUnionDistinct.json @@ -1,11 +1,12 @@ { + "help" : [ "LogicalUnion(all=[false])\n LogicalUnion(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalUnion(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "distinct" : { @@ -13,6 +14,25 @@ "distinct" : { "union" : [ { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -40,29 +60,29 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -90,31 +110,31 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } } ] } }, { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "30" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -142,33 +162,33 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + } ] + } + }, { + "distinct" : { + "union" : [ { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - } ] - } - }, { - "distinct" : { - "union" : [ { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -196,29 +216,29 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -246,29 +266,29 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -296,29 +316,9 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } } ] } - } ], - "help" : [ "LogicalUnion(all=[false])\n LogicalUnion(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalUnion(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testMergeUnionMixed2.json b/tests/calcite/testMergeUnionMixed2.json index ea5990a..9633529 100644 --- a/tests/calcite/testMergeUnionMixed2.json +++ b/tests/calcite/testMergeUnionMixed2.json @@ -1,17 +1,37 @@ { + "help" : [ "LogicalUnion(all=[false])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalUnion(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "distinct" : { "union" : [ { "union" : [ { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -39,29 +59,29 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -89,30 +109,30 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } } ] }, { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "30" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -140,33 +160,33 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + } ] + } + }, { + "distinct" : { + "union" : [ { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - } ] - } - }, { - "distinct" : { - "union" : [ { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -194,29 +214,29 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -244,29 +264,29 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -294,29 +314,9 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } } ] } - } ], - "help" : [ "LogicalUnion(all=[false])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalUnion(all=[false])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 30)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testMinReuseDistinctAttrWithMixedOptionality.json b/tests/calcite/testMinReuseDistinctAttrWithMixedOptionality.json index b5e73fc..773f3e1 100644 --- a/tests/calcite/testMinReuseDistinctAttrWithMixedOptionality.json +++ b/tests/calcite/testMinReuseDistinctAttrWithMixedOptionality.json @@ -1,244 +1,107 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[MIN($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT($0)], EXPR$2=[MIN($0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : true, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" } ], + "function" : [ ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM(DISTINCT $0)], EXPR$1=[COUNT(DISTINCT $0)], EXPR$2=[MIN($0)])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[COUNT($0)], EXPR$2=[MIN($0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testMinusMergeRule.json b/tests/calcite/testMinusMergeRule.json deleted file mode 100644 index 4fab3ef..0000000 --- a/tests/calcite/testMinusMergeRule.json +++ /dev/null @@ -1,562 +0,0 @@ -{ - "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], - "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] - } ], - "queries" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "except" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "except" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "except" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "except" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } ] - } - } - } ] - } - } - }, { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } - }, { - "except" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "except" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } ] - }, { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } ], - "help" : [ "LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalMinus(all=[true])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalMinus(all=[true])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalMinus(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0], EXPR$2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalMinus(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0], EXPR$2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalMinus(all=[true])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalMinus(all=[true])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] -} \ No newline at end of file diff --git a/tests/calcite/testMultipleDistinctWithGrouping.json b/tests/calcite/testMultipleDistinctWithGrouping.json index a7f2812..addcecf 100644 --- a/tests/calcite/testMultipleDistinctWithGrouping.json +++ b/tests/calcite/testMultipleDistinctWithGrouping.json @@ -1,121 +1,68 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[AVG(DISTINCT $1)], EXPR$3=[SUM(DISTINCT $0)])\n LogicalProject(SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$0], EXPR$1=[$1], EXPR$2=[$3], EXPR$3=[$5])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$2=[AVG($1)])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$3=[SUM($0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(SAL=[$0])\n LogicalProject(SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "AVG", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "column" : 5, "type" : "INTEGER" }, { - "operator" : "SUM", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, + "column" : 6, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } }, { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "IS NOT DISTINCT FROM", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -123,13 +70,12 @@ "column" : 4, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT DISTINCT FROM" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "IS NOT DISTINCT FROM", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -137,483 +83,152 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT DISTINCT FROM" }, "left" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 5, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + }, { + "column" : 6, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } }, + "kind" : "INNER", "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "AVG", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + }, { + "column" : 1, "type" : "INTEGER" } ], + "function" : [ ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ] } } } - } ] + } } } } }, + "kind" : "INNER", "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" } ], + "function" : [ ], "source" : { - "distinct" : { - "correlate" : [ { + "project" : { + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, + "scan" : 0 + }, + "target" : [ { + "column" : 5, "type" : "INTEGER" }, { - "column" : 1, + "column" : 6, "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } } } - } ] + } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[AVG(DISTINCT $1)], EXPR$3=[SUM(DISTINCT $0)])\n LogicalProject(SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$0], EXPR$1=[$1], EXPR$2=[$3], EXPR$3=[$5])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $4)], joinType=[inner])\n LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$2=[AVG($1)])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$3=[SUM($0)])\n LogicalAggregate(group=[{0}])\n LogicalProject(SAL=[$0])\n LogicalProject(SAL=[$5], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testNoOversimplificationBelowIsNull.json b/tests/calcite/testNoOversimplificationBelowIsNull.json index 554800c..a2563fe 100644 --- a/tests/calcite/testNoOversimplificationBelowIsNull.json +++ b/tests/calcite/testNoOversimplificationBelowIsNull.json @@ -1,113 +1,83 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NULL(OR(AND(=($0, 1), =($3, 1)), AND(=($0, null), =($3, 1))))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NULL(OR(AND(=($0, 1), =($3, 1)), AND(null, =($3, 1))))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" } ], - "type" : "BOOLEAN" + "operator" : "OR" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -135,69 +105,99 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "NULL", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "NULL" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" } ], - "type" : "BOOLEAN" + "operator" : "OR" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NULL(OR(AND(=($0, 1), =($3, 1)), AND(=($0, null), =($3, 1))))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NULL(OR(AND(=($0, 1), =($3, 1)), AND(null, =($3, 1))))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testOrAlwaysTrue.json b/tests/calcite/testOrAlwaysTrue.json index bb8769d..8b6f793 100644 --- a/tests/calcite/testOrAlwaysTrue.json +++ b/tests/calcite/testOrAlwaysTrue.json @@ -1,62 +1,72 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$7])\n LogicalFilter(condition=[OR(IS NULL($5), IS NOT NULL($5))])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$7])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ], "schemas" : [ { - "name" : "EMPNULLABLES", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true, true, true, true, true, true, true ], + "name" : "CATALOG.SALES.EMPNULLABLES", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1000" + } ], + "operator" : ">" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -81,48 +91,11 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -147,9 +120,46 @@ }, { "column" : 7, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1000" + } ], + "operator" : ">" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -174,44 +184,34 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$7])\n LogicalFilter(condition=[OR(IS NULL($5), IS NOT NULL($5))])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$7])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testOrAlwaysTrue2.json b/tests/calcite/testOrAlwaysTrue2.json index 11b255f..6643153 100644 --- a/tests/calcite/testOrAlwaysTrue2.json +++ b/tests/calcite/testOrAlwaysTrue2.json @@ -1,62 +1,72 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$7])\n LogicalFilter(condition=[OR(IS NOT NULL($5), IS NULL($5))])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$7])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ], "schemas" : [ { - "name" : "EMPNULLABLES", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true, true, true, true, true, true, true ], + "name" : "CATALOG.SALES.EMPNULLABLES", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1000" + } ], + "operator" : ">" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -81,48 +91,11 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -147,9 +120,46 @@ }, { "column" : 7, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1000" + } ], + "operator" : ">" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -174,44 +184,34 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$7])\n LogicalFilter(condition=[OR(IS NOT NULL($5), IS NULL($5))])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$7])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testOversimplifiedCaseStatement.json b/tests/calcite/testOversimplifiedCaseStatement.json index b193821..2557929 100644 --- a/tests/calcite/testOversimplifiedCaseStatement.json +++ b/tests/calcite/testOversimplifiedCaseStatement.json @@ -1,74 +1,47 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(>($3, 0), >(CASE(>($3, 0), /($7, $3), null:INTEGER), 1))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(>($3, 0), CASE(>($3, 0), >(/($7, $3), 1), false))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "/", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -76,30 +49,27 @@ "column" : 3, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "/" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "INTEGER" + "operator" : "CASE" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -127,39 +97,42 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "CASE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "/", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -167,28 +140,55 @@ "column" : 3, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "/" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "false", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "false" } ], - "type" : "BOOLEAN" + "operator" : "CASE" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(>($3, 0), >(CASE(>($3, 0), /($7, $3), null:INTEGER), 1))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(>($3, 0), CASE(>($3, 0), >(/($7, $3), 1), false))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testProjectAggregateMerge.json b/tests/calcite/testProjectAggregateMerge.json index da95205..c92a994 100644 --- a/tests/calcite/testProjectAggregateMerge.json +++ b/tests/calcite/testProjectAggregateMerge.json @@ -1,231 +1,125 @@ { + "help" : [ "LogicalProject(EXPR$0=[+($1, $3)])\n LogicalAggregate(group=[{0, 1}], MS=[MIN($2)], SS=[SUM($2)])\n LogicalProject(JOB=[$2], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject($f0=[+($1, $2)])\n LogicalAggregate(group=[{0, 1}], SS=[SUM($2)])\n LogicalProject(JOB=[$2], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "+", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 2, "type" : "VARCHAR" }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "column" : 7, "type" : "INTEGER" }, { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "column" : 5, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 1, "type" : "INTEGER" }, { - "column" : 2, + "column" : 3, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], + "operator" : "+" + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 2, "type" : "VARCHAR" }, { - "column" : 1, + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + }, { + "column" : 5, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "+" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[+($1, $3)])\n LogicalAggregate(group=[{0, 1}], MS=[MIN($2)], SS=[SUM($2)])\n LogicalProject(JOB=[$2], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject($f0=[+($1, $2)])\n LogicalAggregate(group=[{0, 1}], SS=[SUM($2)])\n LogicalProject(JOB=[$2], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testProjectAggregateMergeSum0.json b/tests/calcite/testProjectAggregateMergeSum0.json index a0e0181..c21a84c 100644 --- a/tests/calcite/testProjectAggregateMergeSum0.json +++ b/tests/calcite/testProjectAggregateMergeSum0.json @@ -1,143 +1,89 @@ { + "help" : [ "LogicalProject(SS0=[CASE(IS NOT NULL($0), CAST($0):INTEGER NOT NULL, 0)])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], agg#0=[$SUM0($0)])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ] + } + } + } + }, "target" : [ { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], + "operator" : "0" + } ], + "operator" : "CASE" + } ] + } + }, { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "$SUM0", + "ignoreNulls" : false } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "distinct" : { - "correlate" : [ { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "column" : 5, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } - } ], - "help" : [ "LogicalProject(SS0=[CASE(IS NOT NULL($0), CAST($0):INTEGER NOT NULL, 0)])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], agg#0=[$SUM0($0)])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testProjectAggregateMergeSum0AndSum.json b/tests/calcite/testProjectAggregateMergeSum0AndSum.json index 225b404..e3f190b 100644 --- a/tests/calcite/testProjectAggregateMergeSum0AndSum.json +++ b/tests/calcite/testProjectAggregateMergeSum0AndSum.json @@ -1,182 +1,128 @@ { + "help" : [ "LogicalProject(EXPR$0=[*($0, 2)], SS0=[CASE(IS NOT NULL($0), CAST($0):INTEGER NOT NULL, 0)])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject($f0=[*($0, 2)], $f1=[$1])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)], agg#1=[$SUM0($0)])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ] + } + } + } + }, "target" : [ { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "INTEGER" + "operator" : "*" }, { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "INTEGER" - } ], + "operator" : "CASE" + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "column" : 5, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "INTEGER" + "operator" : "*" }, { "column" : 1, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "$SUM0", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[*($0, 2)], SS0=[CASE(IS NOT NULL($0), CAST($0):INTEGER NOT NULL, 0)])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject($f0=[*($0, 2)], $f1=[$1])\n LogicalAggregate(group=[{}], SUM_SAL=[SUM($0)], agg#1=[$SUM0($0)])\n LogicalProject(SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testProjectCorrelateTransposeRuleAntiCorrelate.json b/tests/calcite/testProjectCorrelateTransposeRuleAntiCorrelate.json index 0f44287..1b7d26b 100644 --- a/tests/calcite/testProjectCorrelateTransposeRuleAntiCorrelate.json +++ b/tests/calcite/testProjectCorrelateTransposeRuleAntiCorrelate.json @@ -1,104 +1,112 @@ { + "help" : [ "LogicalProject(f=[$0])\n LogicalCorrelate(correlation=[$cor0], joinType=[anti], requiredColumns=[{0}])\n LogicalValues(tuples=[[{ '1', '2' }]])\n LogicalProject(f3=[$0], $f1=[$cor0.f])\n LogicalValues(tuples=[[{ '1', '2' }]])\n", "LogicalCorrelate(correlation=[$cor0], joinType=[anti], requiredColumns=[{0}])\n LogicalProject(f=[$0])\n LogicalValues(tuples=[[{ '1', '2' }]])\n LogicalProject\n LogicalProject(f3=[$0], $f1=[$cor0.f])\n LogicalValues(tuples=[[{ '1', '2' }]])\n" ], "schemas" : [ ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "CHAR" - } ], "source" : { - "correlate" : [ { - "values" : { - "schema" : [ "CHAR", "CHAR" ], - "content" : [ [ { - "operator" : "_ISO-8859-1'1'", - "operand" : [ ], - "type" : "CHAR" - }, { - "operator" : "_ISO-8859-1'2'", - "operand" : [ ], - "type" : "CHAR" - } ] ] - } - }, { - "project" : { - "target" : [ { - "column" : 2, - "type" : "CHAR" - }, { - "column" : 0, - "type" : "CHAR" - } ], - "source" : { - "values" : { - "schema" : [ "CHAR", "CHAR" ], - "content" : [ [ { - "operator" : "_ISO-8859-1'1'", - "operand" : [ ], - "type" : "CHAR" - }, { - "operator" : "_ISO-8859-1'2'", - "operand" : [ ], - "type" : "CHAR" - } ] ] - } + "correlate" : { + "left" : { + "values" : { + "schema" : [ "CHAR", "CHAR" ], + "content" : [ [ { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'1'" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'2'" + } ] ] + } + }, + "kind" : "ANTI", + "right" : { + "project" : { + "source" : { + "values" : { + "schema" : [ "CHAR", "CHAR" ], + "content" : [ [ { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'1'" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'2'" + } ] ] + } + }, + "target" : [ { + "column" : 2, + "type" : "CHAR" + }, { + "column" : 0, + "type" : "CHAR" + } ] } } - } ] - } + } + }, + "target" : [ { + "column" : 0, + "type" : "CHAR" + } ] } }, { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "CHAR" - } ], - "source" : { - "values" : { - "schema" : [ "CHAR", "CHAR" ], - "content" : [ [ { - "operator" : "_ISO-8859-1'1'", - "operand" : [ ], - "type" : "CHAR" - }, { - "operator" : "_ISO-8859-1'2'", - "operand" : [ ], - "type" : "CHAR" - } ] ] - } + "correlate" : { + "left" : { + "project" : { + "source" : { + "values" : { + "schema" : [ "CHAR", "CHAR" ], + "content" : [ [ { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'1'" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'2'" + } ] ] + } + }, + "target" : [ { + "column" : 0, + "type" : "CHAR" + } ] } - } - }, { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "CHAR" - }, { - "column" : 0, - "type" : "CHAR" - } ], - "source" : { - "values" : { - "schema" : [ "CHAR", "CHAR" ], - "content" : [ [ { - "operator" : "_ISO-8859-1'1'", - "operand" : [ ], - "type" : "CHAR" - }, { - "operator" : "_ISO-8859-1'2'", - "operand" : [ ], - "type" : "CHAR" - } ] ] - } + }, + "kind" : "ANTI", + "right" : { + "project" : { + "source" : { + "project" : { + "source" : { + "values" : { + "schema" : [ "CHAR", "CHAR" ], + "content" : [ [ { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'1'" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'2'" + } ] ] + } + }, + "target" : [ { + "column" : 1, + "type" : "CHAR" + }, { + "column" : 0, + "type" : "CHAR" + } ] } - } + }, + "target" : [ ] } } - } ] - } ], - "help" : [ "LogicalProject(f=[$0])\n LogicalCorrelate(correlation=[$cor0], joinType=[anti], requiredColumns=[{0}])\n LogicalValues(tuples=[[{ '1', '2' }]])\n LogicalProject(f3=[$0], $f1=[$cor0.f])\n LogicalValues(tuples=[[{ '1', '2' }]])\n", "LogicalCorrelate(correlation=[$cor0], joinType=[anti], requiredColumns=[{0}])\n LogicalProject(f=[$0])\n LogicalValues(tuples=[[{ '1', '2' }]])\n LogicalProject\n LogicalProject(f3=[$0], $f1=[$cor0.f])\n LogicalValues(tuples=[[{ '1', '2' }]])\n" ] + } + } ] } \ No newline at end of file diff --git a/tests/calcite/testProjectCorrelateTransposeRuleLeftCorrelate.json b/tests/calcite/testProjectCorrelateTransposeRuleLeftCorrelate.json index 52d344b..1b7d5de 100644 --- a/tests/calcite/testProjectCorrelateTransposeRuleLeftCorrelate.json +++ b/tests/calcite/testProjectCorrelateTransposeRuleLeftCorrelate.json @@ -1,281 +1,195 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalProject(EMPNO=[$0], $f0=[$2])\n LogicalCorrelate(correlation=[$cor2], joinType=[left], requiredColumns=[{1}])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject($f0=[$0])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor2.DEPTNO, $0)])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { - "correlate" : [ { - "scan" : 0 - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 9, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, + "correlate" : { + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, "type" : "BOOLEAN" } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } + "operator" : "=" + }, + "source" : { + "scan" : 1 } } - } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] } } - } ] + } } - } ] + } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "BOOLEAN" - } ], "source" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 + "correlate" : { + "left" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ] } - } - }, { - "project" : { - "target" : [ { - "column" : 2, - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, + }, + "kind" : "LEFT", + "right" : { + "project" : { + "source" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, "type" : "BOOLEAN" } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } + "operator" : "=" + }, + "source" : { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ] } } } - } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] } } - } ] - } + } + }, + "target" : [ { + "column" : 2, + "type" : "BOOLEAN" + } ] } } - } ] - } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BOOLEAN" + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($1)])\n LogicalProject(EMPNO=[$0], $f0=[$2])\n LogicalCorrelate(correlation=[$cor2], joinType=[left], requiredColumns=[{1}])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject($f0=[$0])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[=($cor2.DEPTNO, $0)])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testProjectCorrelateTransposeRuleSemiCorrelate.json b/tests/calcite/testProjectCorrelateTransposeRuleSemiCorrelate.json index 9868d89..769484d 100644 --- a/tests/calcite/testProjectCorrelateTransposeRuleSemiCorrelate.json +++ b/tests/calcite/testProjectCorrelateTransposeRuleSemiCorrelate.json @@ -1,104 +1,112 @@ { + "help" : [ "LogicalProject(f=[$0])\n LogicalCorrelate(correlation=[$cor0], joinType=[semi], requiredColumns=[{0}])\n LogicalValues(tuples=[[{ '1', '2' }]])\n LogicalProject(f3=[$0], $f1=[$cor0.f])\n LogicalValues(tuples=[[{ '1', '2' }]])\n", "LogicalCorrelate(correlation=[$cor0], joinType=[semi], requiredColumns=[{0}])\n LogicalProject(f=[$0])\n LogicalValues(tuples=[[{ '1', '2' }]])\n LogicalProject\n LogicalProject(f3=[$0], $f1=[$cor0.f])\n LogicalValues(tuples=[[{ '1', '2' }]])\n" ], "schemas" : [ ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "CHAR" - } ], "source" : { - "correlate" : [ { - "values" : { - "schema" : [ "CHAR", "CHAR" ], - "content" : [ [ { - "operator" : "_ISO-8859-1'1'", - "operand" : [ ], - "type" : "CHAR" - }, { - "operator" : "_ISO-8859-1'2'", - "operand" : [ ], - "type" : "CHAR" - } ] ] - } - }, { - "project" : { - "target" : [ { - "column" : 2, - "type" : "CHAR" - }, { - "column" : 0, - "type" : "CHAR" - } ], - "source" : { - "values" : { - "schema" : [ "CHAR", "CHAR" ], - "content" : [ [ { - "operator" : "_ISO-8859-1'1'", - "operand" : [ ], - "type" : "CHAR" - }, { - "operator" : "_ISO-8859-1'2'", - "operand" : [ ], - "type" : "CHAR" - } ] ] - } + "correlate" : { + "left" : { + "values" : { + "schema" : [ "CHAR", "CHAR" ], + "content" : [ [ { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'1'" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'2'" + } ] ] + } + }, + "kind" : "SEMI", + "right" : { + "project" : { + "source" : { + "values" : { + "schema" : [ "CHAR", "CHAR" ], + "content" : [ [ { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'1'" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'2'" + } ] ] + } + }, + "target" : [ { + "column" : 2, + "type" : "CHAR" + }, { + "column" : 0, + "type" : "CHAR" + } ] } } - } ] - } + } + }, + "target" : [ { + "column" : 0, + "type" : "CHAR" + } ] } }, { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "CHAR" - } ], - "source" : { - "values" : { - "schema" : [ "CHAR", "CHAR" ], - "content" : [ [ { - "operator" : "_ISO-8859-1'1'", - "operand" : [ ], - "type" : "CHAR" - }, { - "operator" : "_ISO-8859-1'2'", - "operand" : [ ], - "type" : "CHAR" - } ] ] - } + "correlate" : { + "left" : { + "project" : { + "source" : { + "values" : { + "schema" : [ "CHAR", "CHAR" ], + "content" : [ [ { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'1'" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'2'" + } ] ] + } + }, + "target" : [ { + "column" : 0, + "type" : "CHAR" + } ] } - } - }, { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "CHAR" - }, { - "column" : 0, - "type" : "CHAR" - } ], - "source" : { - "values" : { - "schema" : [ "CHAR", "CHAR" ], - "content" : [ [ { - "operator" : "_ISO-8859-1'1'", - "operand" : [ ], - "type" : "CHAR" - }, { - "operator" : "_ISO-8859-1'2'", - "operand" : [ ], - "type" : "CHAR" - } ] ] - } + }, + "kind" : "SEMI", + "right" : { + "project" : { + "source" : { + "project" : { + "source" : { + "values" : { + "schema" : [ "CHAR", "CHAR" ], + "content" : [ [ { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'1'" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'2'" + } ] ] + } + }, + "target" : [ { + "column" : 1, + "type" : "CHAR" + }, { + "column" : 0, + "type" : "CHAR" + } ] } - } + }, + "target" : [ ] } } - } ] - } ], - "help" : [ "LogicalProject(f=[$0])\n LogicalCorrelate(correlation=[$cor0], joinType=[semi], requiredColumns=[{0}])\n LogicalValues(tuples=[[{ '1', '2' }]])\n LogicalProject(f3=[$0], $f1=[$cor0.f])\n LogicalValues(tuples=[[{ '1', '2' }]])\n", "LogicalCorrelate(correlation=[$cor0], joinType=[semi], requiredColumns=[{0}])\n LogicalProject(f=[$0])\n LogicalValues(tuples=[[{ '1', '2' }]])\n LogicalProject\n LogicalProject(f3=[$0], $f1=[$cor0.f])\n LogicalValues(tuples=[[{ '1', '2' }]])\n" ] + } + } ] } \ No newline at end of file diff --git a/tests/calcite/testProjectFilterTransposeRuleOnEmptyRowType.json b/tests/calcite/testProjectFilterTransposeRuleOnEmptyRowType.json index e0794b3..7d1ad97 100644 --- a/tests/calcite/testProjectFilterTransposeRuleOnEmptyRowType.json +++ b/tests/calcite/testProjectFilterTransposeRuleOnEmptyRowType.json @@ -1,66 +1,66 @@ { + "help" : [ "LogicalProject\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[scott, EMP]])\n", "LogicalProject\n LogicalFilter(condition=[=($0, 20)])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[scott, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true, true, true, true, true, true ], + "name" : "scott.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "key" : [ [ 0 ], [ 1 ] ] } ], "queries" : [ { "project" : { - "target" : [ ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "TINYINT" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ ] } }, { "project" : { - "target" : [ ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "TINYINT" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 7, "type" : "TINYINT" - } ], - "source" : { - "scan" : 0 - } + } ] } } } - } + }, + "target" : [ ] } - } ], - "help" : [ "LogicalProject\n LogicalFilter(condition=[=($7, 20)])\n LogicalTableScan(table=[[scott, EMP]])\n", "LogicalProject\n LogicalFilter(condition=[=($0, 20)])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[scott, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testProjectJoinRemove1.json b/tests/calcite/testProjectJoinRemove1.json index 241391b..b6e246d 100644 --- a/tests/calcite/testProjectJoinRemove1.json +++ b/tests/calcite/testProjectJoinRemove1.json @@ -1,33 +1,26 @@ { + "help" : [ "LogicalProject(DEPTNO=[$7], DEPTNO0=[$11])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$7], DEPTNO0=[$9])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -35,13 +28,12 @@ "column" : 11, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -49,36 +41,37 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "scan" : 1 } } }, + "kind" : "LEFT", "right" : { "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 7, "type" : "INTEGER" }, { - "column" : 9, + "column" : 11, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -86,17 +79,24 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$7], DEPTNO0=[$11])\n LogicalJoin(condition=[=($7, $11)], joinType=[left])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$7], DEPTNO0=[$9])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testProjectJoinRemove10.json b/tests/calcite/testProjectJoinRemove10.json index 21452bf..d3d698f 100644 --- a/tests/calcite/testProjectJoinRemove10.json +++ b/tests/calcite/testProjectJoinRemove10.json @@ -1,33 +1,26 @@ { + "help" : [ "LogicalProject(DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -35,30 +28,37 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 7, "type" : "INTEGER" }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testProjectJoinRemove4.json b/tests/calcite/testProjectJoinRemove4.json index 15b6724..44d19c1 100644 --- a/tests/calcite/testProjectJoinRemove4.json +++ b/tests/calcite/testProjectJoinRemove4.json @@ -1,30 +1,26 @@ { + "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -32,27 +28,31 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$7])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testProjectJoinRemove7.json b/tests/calcite/testProjectJoinRemove7.json index 5be942b..93142ef 100644 --- a/tests/calcite/testProjectJoinRemove7.json +++ b/tests/calcite/testProjectJoinRemove7.json @@ -1,30 +1,26 @@ { + "help" : [ "LogicalProject(DEPTNO=[$9])\n LogicalJoin(condition=[=($9, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "RIGHT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" @@ -32,27 +28,31 @@ "column" : 0, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "RIGHT", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ] } }, { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$9])\n LogicalJoin(condition=[=($9, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testProjectJoinTransposeItem.json b/tests/calcite/testProjectJoinTransposeItem.json index 67558de..7414c19 100644 --- a/tests/calcite/testProjectJoinTransposeItem.json +++ b/tests/calcite/testProjectJoinTransposeItem.json @@ -1,42 +1,19 @@ { + "help" : [ "LogicalProject(EXPR$0=[ITEM($0, 0)], EXPR$1=[ITEM($2, 0)])\n LogicalJoin(condition=[=($1, $3)], joinType=[left])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$3])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalProject($f1=[$1], EXPR$0=[ITEM($0, 0)])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n LogicalProject($f1=[$1], EXPR$0=[ITEM($0, 0)])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n" ], "schemas" : [ { - "name" : "CUSTOMER", - "fields" : [ "C_NATIONKEY" ], "types" : [ "ANY" ], - "strategy" : [ "NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ true ], + "name" : "CATALOG.SALES.CUSTOMER", + "guaranteed" : [ ], + "fields" : [ "C_NATIONKEY" ], + "key" : [ ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "ITEM", - "operand" : [ { - "column" : 0, - "type" : "ANY" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "ANY" - }, { - "operator" : "ITEM", - "operand" : [ { - "column" : 2, - "type" : "ANY" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "ANY" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "ANY" @@ -44,69 +21,85 @@ "column" : 3, "type" : "ANY" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "ANY" }, { - "operator" : "ITEM", + "type" : "ANY", "operand" : [ { "column" : 0, "type" : "ANY" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "ANY" - } ], - "source" : { - "scan" : 0 - } + "operator" : "ITEM" + } ] } }, + "kind" : "LEFT", "right" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "ANY" }, { - "operator" : "ITEM", + "type" : "ANY", "operand" : [ { "column" : 0, "type" : "ANY" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "ANY" - } ], - "source" : { - "scan" : 0 - } + "operator" : "ITEM" + } ] } } } - } + }, + "target" : [ { + "type" : "ANY", + "operand" : [ { + "column" : 0, + "type" : "ANY" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "ITEM" + }, { + "type" : "ANY", + "operand" : [ { + "column" : 2, + "type" : "ANY" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "ITEM" + } ] } }, { "project" : { - "target" : [ { - "column" : 1, - "type" : "ANY" - }, { - "column" : 3, - "type" : "ANY" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "ANY" @@ -114,93 +107,100 @@ "column" : 2, "type" : "ANY" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { - "target" : [ { - "column" : 1, - "type" : "ANY" - }, { - "operator" : "ITEM", - "operand" : [ { - "column" : 0, - "type" : "ANY" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "ANY" - } ], "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "ANY" }, { - "operator" : "ITEM", + "type" : "ANY", "operand" : [ { "column" : 0, "type" : "ANY" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "ANY" - } ], - "source" : { - "scan" : 0 - } + "operator" : "ITEM" + } ] } - } - } - }, - "right" : { - "project" : { + }, "target" : [ { "column" : 1, "type" : "ANY" }, { - "operator" : "ITEM", + "type" : "ANY", "operand" : [ { "column" : 0, "type" : "ANY" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "ANY" - } ], + "operator" : "ITEM" + } ] + } + }, + "kind" : "LEFT", + "right" : { + "project" : { "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "ANY" }, { - "operator" : "ITEM", + "type" : "ANY", "operand" : [ { "column" : 0, "type" : "ANY" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "ANY" - } ], - "source" : { - "scan" : 0 - } + "operator" : "ITEM" + } ] } - } + }, + "target" : [ { + "column" : 1, + "type" : "ANY" + }, { + "type" : "ANY", + "operand" : [ { + "column" : 0, + "type" : "ANY" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "ITEM" + } ] } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "ANY" + }, { + "column" : 3, + "type" : "ANY" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[ITEM($0, 0)], EXPR$1=[ITEM($2, 0)])\n LogicalJoin(condition=[=($1, $3)], joinType=[left])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$3])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalProject($f1=[$1], EXPR$0=[ITEM($0, 0)])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n LogicalProject($f1=[$1], EXPR$0=[ITEM($0, 0)])\n LogicalProject(C_NATIONKEY=[$0], $f1=[ITEM($0, 0)])\n LogicalTableScan(table=[[CATALOG, SALES, CUSTOMER]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testProjectSetOpTranspose.json b/tests/calcite/testProjectSetOpTranspose.json index 7dede2d..7ed8d6e 100644 --- a/tests/calcite/testProjectSetOpTranspose.json +++ b/tests/calcite/testProjectSetOpTranspose.json @@ -1,23 +1,21 @@ { + "help" : [ "LogicalProject(JOB=[$2], EXPR$1=[SUM(+($5, 100)) OVER (PARTITION BY $7)])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(JOB=[$0], EXPR$1=[SUM($2) OVER (PARTITION BY $1)])\n LogicalUnion(all=[true])\n LogicalProject(JOB=[$2], DEPTNO=[$7], EXPR$0=[+($5, 100)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$2], DEPTNO=[$7], EXPR$0=[+($5, 100)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "error" : "Not implemented: SUM" - } ], "source" : { "union" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -45,13 +43,13 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -79,45 +77,40 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + } ] } } ] - } - } - }, { - "project" : { + }, "target" : [ { - "column" : 0, + "column" : 2, "type" : "VARCHAR" }, { - "error" : "Not implemented: SUM" - } ], + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "100" + } ], + "operator" : "+" + } ], + "operator" : "SUM" + } ] + } + }, { + "project" : { "source" : { "union" : [ { "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "100", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -145,15 +138,9 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + } ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 2, "type" : "VARCHAR" @@ -161,19 +148,25 @@ "column" : 7, "type" : "INTEGER" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "INTEGER" - } ], + "operator" : "+" + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -201,16 +194,41 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + } ] } - } + }, + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "100" + } ], + "operator" : "+" + } ] } } ] - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM" + } ] } - } ], - "help" : [ "LogicalProject(JOB=[$2], EXPR$1=[SUM(+($5, 100)) OVER (PARTITION BY $7)])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(JOB=[$0], EXPR$1=[SUM($2) OVER (PARTITION BY $1)])\n LogicalUnion(all=[true])\n LogicalProject(JOB=[$2], DEPTNO=[$7], EXPR$0=[+($5, 100)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$2], DEPTNO=[$7], EXPR$0=[+($5, 100)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullAggregateThroughUnion.json b/tests/calcite/testPullAggregateThroughUnion.json index d008c60..942c0f4 100644 --- a/tests/calcite/testPullAggregateThroughUnion.json +++ b/tests/calcite/testPullAggregateThroughUnion.json @@ -1,470 +1,116 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } ] - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } ] - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 7, "type" : "INTEGER" }, { "column" : 2, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 7, "type" : "INTEGER" }, { "column" : 2, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ] + } + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ] + } + } ] + } + } + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullAggregateThroughUnion2.json b/tests/calcite/testPullAggregateThroughUnion2.json index d008c60..942c0f4 100644 --- a/tests/calcite/testPullAggregateThroughUnion2.json +++ b/tests/calcite/testPullAggregateThroughUnion2.json @@ -1,470 +1,116 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } ] - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } ] - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 7, "type" : "INTEGER" }, { "column" : 2, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 7, "type" : "INTEGER" }, { "column" : 2, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ] + } + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ] + } + } ] + } + } + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullAggregateThroughUnionAndAddProjects.json b/tests/calcite/testPullAggregateThroughUnionAndAddProjects.json index bc5e1e4..2c52a6e 100644 --- a/tests/calcite/testPullAggregateThroughUnionAndAddProjects.json +++ b/tests/calcite/testPullAggregateThroughUnionAndAddProjects.json @@ -1,470 +1,116 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalProject(JOB=[$2], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$2], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } ] - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } ] - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 2, "type" : "VARCHAR" }, { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 2, "type" : "VARCHAR" }, { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalProject(JOB=[$2], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$2], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ] + } + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ] + } + } ] + } + } + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullAggregateThroughUnionWithAlias.json b/tests/calcite/testPullAggregateThroughUnionWithAlias.json index 994572d..fe80dfe 100644 --- a/tests/calcite/testPullAggregateThroughUnionWithAlias.json +++ b/tests/calcite/testPullAggregateThroughUnionWithAlias.json @@ -1,572 +1,128 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], C=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$0], C=[$1])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{2, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$2], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 2, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 7, + "type" : "INTEGER" } ] } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 2, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 7, + "type" : "INTEGER" } ] } - } ] + } } - } + } ] + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ ], + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "project" : { "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "union" : [ { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "function" : [ ], + "source" : { + "scan" : 0 + } + } + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 2, + "type" : "VARCHAR" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 7, + "type" : "INTEGER" } ] } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { + } ] + }, "target" : [ { "column" : 0, "type" : "VARCHAR" }, { "column" : 1, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - }, { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - }, { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } - } - } - } + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], C=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$2], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}])\n LogicalProject(JOB=[$0], C=[$1])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{2, 7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(JOB=[$2], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullConstantIntoFilter.json b/tests/calcite/testPullConstantIntoFilter.json index d1f3f3a..d34c5dd 100644 --- a/tests/calcite/testPullConstantIntoFilter.json +++ b/tests/calcite/testPullConstantIntoFilter.json @@ -1,106 +1,51 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>(+($7, 5), $0)])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>(15, $0)])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "5", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "5" } ], - "type" : "INTEGER" + "operator" : "+" }, { "column" : 0, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 @@ -108,12 +53,37 @@ } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -141,9 +111,47 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "15" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : ">" + }, + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -171,45 +179,37 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "operator" : "15", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>(+($7, 5), $0)])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>(15, $0)])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullConstantIntoJoin.json b/tests/calcite/testPullConstantIntoJoin.json index c1a10a7..2da3e6e 100644 --- a/tests/calcite/testPullConstantIntoJoin.json +++ b/tests/calcite/testPullConstantIntoJoin.json @@ -1,60 +1,26 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -62,10 +28,29 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -93,36 +78,15 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } }, + "kind" : "LEFT", "right" : { "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -156,17 +120,38 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -194,41 +179,23 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } }, + "kind" : "LEFT", "right" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 1 @@ -236,8 +203,41 @@ } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[true], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullConstantIntoJoin2.json b/tests/calcite/testPullConstantIntoJoin2.json index dbb2a21..88d689d 100644 --- a/tests/calcite/testPullConstantIntoJoin2.json +++ b/tests/calcite/testPullConstantIntoJoin2.json @@ -1,62 +1,28 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$10], NAME=[$11])\n LogicalJoin(condition=[AND(=($0, $10), =($9, $12))], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[10], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[10], NAME=[$11])\n LogicalJoin(condition=[=($9, 15)], joinType=[inner])\n LogicalProject(EMPNO=[10], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, 10)])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[10], NAME=[$1], $f2=[15])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -64,9 +30,9 @@ "column" : 10, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" @@ -74,12 +40,31 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -108,7 +93,7 @@ "column" : 8, "type" : "BOOLEAN" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -116,31 +101,16 @@ "column" : 0, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + "operator" : "+" + } ] } }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -148,30 +118,23 @@ "column" : 1, "type" : "VARCHAR" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "5", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "5" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + "operator" : "+" + } ] } } } - } - } - }, { - "project" : { + }, "target" : [ { - "operator" : "10", - "operand" : [ ], + "column" : 0, "type" : "INTEGER" }, { "column" : 1, @@ -198,34 +161,54 @@ "column" : 8, "type" : "BOOLEAN" }, { - "operator" : "10", - "operand" : [ ], + "column" : 10, "type" : "INTEGER" }, { "column" : 11, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "15", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "15" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { "column" : 1, "type" : "VARCHAR" @@ -251,76 +234,93 @@ "column" : 8, "type" : "BOOLEAN" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "INTEGER" - } ], + "operator" : "+" + } ] + } + }, + "kind" : "INNER", + "right" : { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "scan" : 0 + "scan" : 1 } } - } - } - }, - "right" : { - "project" : { + }, "target" : [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "15", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } + "operator" : "15" + } ] } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + }, { + "column" : 11, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$10], NAME=[$11])\n LogicalJoin(condition=[AND(=($0, $10), =($9, $12))], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[10], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[10], NAME=[$11])\n LogicalJoin(condition=[=($9, 15)], joinType=[inner])\n LogicalProject(EMPNO=[10], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, 10)])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[10], NAME=[$1], $f2=[15])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullConstantIntoProject.json b/tests/calcite/testPullConstantIntoProject.json index 898d8a8..196731f 100644 --- a/tests/calcite/testPullConstantIntoProject.json +++ b/tests/calcite/testPullConstantIntoProject.json @@ -1,30 +1,50 @@ { + "help" : [ "LogicalProject(DEPTNO=[$7], EXPR$1=[+($7, 1)], EXPR$2=[+($0, $7)])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[10], EXPR$1=[11], EXPR$2=[+($0, 10)])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "INTEGER" + "operator" : "+" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -32,70 +52,50 @@ "column" : 7, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], + "operator" : "+" + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { - "operator" : "11", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "11" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + "operator" : "+" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$7], EXPR$1=[+($7, 1)], EXPR$2=[+($0, $7)])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[10], EXPR$1=[11], EXPR$2=[+($0, 10)])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFrom.json b/tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFrom.json index 555c086..419f685 100644 --- a/tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFrom.json +++ b/tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFrom.json @@ -1,155 +1,155 @@ { + "help" : [ "LogicalProject(DEPTNO=[$7], EXPR$1=[+($7, 1)], EXPR$2=[+($0, $7)])\n LogicalFilter(condition=[OR(AND(IS NULL($7), IS NULL(10)), IS TRUE(=($7, 10)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[10], EXPR$1=[11], EXPR$2=[+($0, 10)])\n LogicalFilter(condition=[OR(AND(IS NULL($7), IS NULL(10)), IS TRUE(=($7, 10)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "IS TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "IS TRUE" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { - "operator" : "10", - "operand" : [ ], + "column" : 7, "type" : "INTEGER" }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" + "type" : "INTEGER", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "+" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", - "operand" : [ ], + "column" : 7, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], + "operator" : "+" + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "IS TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "IS TRUE" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "+" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$7], EXPR$1=[+($7, 1)], EXPR$2=[+($0, $7)])\n LogicalFilter(condition=[OR(AND(IS NULL($7), IS NULL(10)), IS TRUE(=($7, 10)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[10], EXPR$1=[11], EXPR$2=[+($0, 10)])\n LogicalFilter(condition=[OR(AND(IS NULL($7), IS NULL(10)), IS TRUE(=($7, 10)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFromDate.json b/tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFromDate.json new file mode 100644 index 0000000..b0dea67 --- /dev/null +++ b/tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFromDate.json @@ -0,0 +1,69 @@ +{ + "help" : [ "LogicalProject(HIREDATE=[$4])\n LogicalFilter(condition=[IS NOT DISTINCT FROM($4, 2020-12-11)])\n LogicalTableScan(table=[[scott, EMP]])\n", "LogicalProject(HIREDATE=[CAST(2020-12-11):DATE])\n LogicalFilter(condition=[IS NOT DISTINCT FROM($4, 2020-12-11)])\n LogicalTableScan(table=[[scott, EMP]])\n" ], + "schemas" : [ { + "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "nullable" : [ false, true, true, true, true, true, true, true ], + "name" : "scott.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "key" : [ [ 0 ], [ 1 ] ] + } ], + "queries" : [ { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "DATE" + }, { + "type" : "DATE", + "operand" : [ ], + "operator" : "java.util.GregorianCalendar[time=1607644800000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2020,MONTH=11,WEEK_OF_YEAR=50,WEEK_OF_MONTH=2,DAY_OF_MONTH=11,DAY_OF_YEAR=346,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=2,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]" + } ], + "operator" : "IS NOT DISTINCT FROM" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 4, + "type" : "DATE" + } ] + } + }, { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "DATE" + }, { + "type" : "DATE", + "operand" : [ ], + "operator" : "java.util.GregorianCalendar[time=1607644800000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2020,MONTH=11,WEEK_OF_YEAR=50,WEEK_OF_MONTH=2,DAY_OF_MONTH=11,DAY_OF_YEAR=346,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=2,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]" + } ], + "operator" : "IS NOT DISTINCT FROM" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "type" : "DATE", + "operand" : [ { + "type" : "DATE", + "operand" : [ ], + "operator" : "java.util.GregorianCalendar[time=1607644800000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"UTC\",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2020,MONTH=11,WEEK_OF_YEAR=50,WEEK_OF_MONTH=2,DAY_OF_MONTH=11,DAY_OF_YEAR=346,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=2,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=0]" + } ], + "operator" : "CAST" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json b/tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json index 901acc6..5a92a3c 100644 --- a/tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json +++ b/tests/calcite/testPullConstantIntoProjectWithIsNotDistinctFromForNull.json @@ -1,125 +1,125 @@ { + "help" : [ "LogicalProject(MGR=[$3], DEPTNO=[$7])\n LogicalFilter(condition=[OR(AND(IS NULL($3), IS NULL(null:INTEGER)), IS TRUE(=($3, null)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(MGR=[null:INTEGER], DEPTNO=[$7])\n LogicalFilter(condition=[OR(AND(IS NULL($3), IS NULL(null:INTEGER)), IS TRUE(=($3, null)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "IS TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "IS TRUE" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { - "operator" : "NULL", - "operand" : [ ], + "column" : 3, "type" : "INTEGER" }, { "column" : 7, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "IS TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "IS TRUE" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "column" : 7, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(MGR=[$3], DEPTNO=[$7])\n LogicalFilter(condition=[OR(AND(IS NULL($3), IS NULL(null:INTEGER)), IS TRUE(=($3, null)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(MGR=[null:INTEGER], DEPTNO=[$7])\n LogicalFilter(condition=[OR(AND(IS NULL($3), IS NULL(null:INTEGER)), IS TRUE(=($3, null)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughAggregateAllConst.json b/tests/calcite/testPullConstantThroughAggregateAllConst.json index 9d63b42..ab2f07b 100644 --- a/tests/calcite/testPullConstantThroughAggregateAllConst.json +++ b/tests/calcite/testPullConstantThroughAggregateAllConst.json @@ -1,222 +1,116 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(EXPR$0=[4], EXPR$1=[+(2, 3)], FIVE=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[+(2, 3)], EXPR$2=[$1])\n LogicalAggregate(group=[{0}], EXPR$2=[MAX($1)])\n LogicalProject(EXPR$0=[4], FIVE=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, - "type" : "INTEGER" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "4" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "3" + } ], + "operator" : "+" }, { - "column" : 1, + "type" : "INTEGER", + "operand" : [ ], + "operator" : "5" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "MAX", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 4, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "MAX", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "project" : { - "target" : [ { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + "scan" : 0 + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "4" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "5" + } ] } } } - } ] - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" } ], - "type" : "INTEGER" + "operator" : "+" }, { "column" : 1, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(EXPR$0=[4], EXPR$1=[+(2, 3)], FIVE=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[+(2, 3)], EXPR$2=[$1])\n LogicalAggregate(group=[{0}], EXPR$2=[MAX($1)])\n LogicalProject(EXPR$0=[4], FIVE=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughAggregateAllLiterals.json b/tests/calcite/testPullConstantThroughAggregateAllLiterals.json index 7542dc7..ce1837b 100644 --- a/tests/calcite/testPullConstantThroughAggregateAllLiterals.json +++ b/tests/calcite/testPullConstantThroughAggregateAllLiterals.json @@ -1,222 +1,116 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(EXPR$0=[4], EXPR$1=[+(2, 3)], $f2=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[+(2, 3)], EXPR$2=[$1])\n LogicalAggregate(group=[{0}], EXPR$2=[MAX($1)])\n LogicalProject(EXPR$0=[4], $f2=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, - "type" : "INTEGER" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "4" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "3" + } ], + "operator" : "+" }, { - "column" : 1, + "type" : "INTEGER", + "operand" : [ ], + "operator" : "5" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "MAX", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 4, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "MAX", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "project" : { - "target" : [ { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + "scan" : 0 + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "4" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "5" + } ] } } } - } ] - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" } ], - "type" : "INTEGER" + "operator" : "+" }, { "column" : 1, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(EXPR$0=[4], EXPR$1=[+(2, 3)], $f2=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[+(2, 3)], EXPR$2=[$1])\n LogicalAggregate(group=[{0}], EXPR$2=[MAX($1)])\n LogicalProject(EXPR$0=[4], $f2=[5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughAggregateConstGroupBy.json b/tests/calcite/testPullConstantThroughAggregateConstGroupBy.json index ef36f4b..1b9518d 100644 --- a/tests/calcite/testPullConstantThroughAggregateConstGroupBy.json +++ b/tests/calcite/testPullConstantThroughAggregateConstGroupBy.json @@ -1,218 +1,114 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(EXPR$0=[4], EXPR$1=[+(2, 3)], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[+(2, 3)], EXPR$2=[$1])\n LogicalAggregate(group=[{0}], EXPR$2=[MAX($1)])\n LogicalProject(EXPR$0=[4], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, - "type" : "INTEGER" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "4" }, { - "column" : 1, + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "3" + } ], + "operator" : "+" + }, { + "column" : 3, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + } ] } - }, { - "aggregate" : { + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], "function" : [ { - "operator" : "MAX", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 4, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "MAX", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "project" : { - "target" : [ { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + "scan" : 0 + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "4" + }, { + "column" : 3, + "type" : "INTEGER" + } ] } } } - } ] - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" } ], - "type" : "INTEGER" + "operator" : "+" }, { "column" : 1, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(EXPR$0=[4], EXPR$1=[+(2, 3)], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[+(2, 3)], EXPR$2=[$1])\n LogicalAggregate(group=[{0}], EXPR$2=[MAX($1)])\n LogicalProject(EXPR$0=[4], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughAggregatePermuted.json b/tests/calcite/testPullConstantThroughAggregatePermuted.json index 0a407bc..9f5db7e 100644 --- a/tests/calcite/testPullConstantThroughAggregatePermuted.json +++ b/tests/calcite/testPullConstantThroughAggregatePermuted.json @@ -1,304 +1,146 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], EXPR$1=[$4])\n LogicalAggregate(group=[{0, 1, 2, 3}], EXPR$1=[MAX($4)])\n LogicalProject(DEPTNO=[$7], FOUR=[4], TWO_PLUS_THREE=[+(2, 3)], DEPTNO42=[+($7, 42)], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(DEPTNO=[$7], DEPTNO42=[+($7, 42)], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" }, { - "column" : 1, - "type" : "INTEGER" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "4" }, { - "column" : 2, - "type" : "INTEGER" + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "3" + } ], + "operator" : "+" }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "42", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", + "type" : "INTEGER", "operand" : [ { - "column" : 8, + "column" : 7, "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "42" } ], - "distinct" : false, - "ignoreNulls" : false, + "operator" : "+" + }, { + "column" : 3, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "operator" : "42", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "column" : 2, + "column" : 4, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "42", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", + "type" : "INTEGER", "operand" : [ { - "column" : 4, + "column" : 7, "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "42" } ], - "distinct" : false, - "ignoreNulls" : false, + "operator" : "+" + }, { + "column" : 3, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "42", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], EXPR$1=[$4])\n LogicalAggregate(group=[{0, 1, 2, 3}], EXPR$1=[MAX($4)])\n LogicalProject(DEPTNO=[$7], FOUR=[4], TWO_PLUS_THREE=[+(2, 3)], DEPTNO42=[+($7, 42)], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(DEPTNO=[$7], DEPTNO42=[+($7, 42)], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughAggregatePermutedConstFirst.json b/tests/calcite/testPullConstantThroughAggregatePermutedConstFirst.json index d33c0af..aa9c661 100644 --- a/tests/calcite/testPullConstantThroughAggregatePermutedConstFirst.json +++ b/tests/calcite/testPullConstantThroughAggregatePermutedConstFirst.json @@ -1,186 +1,92 @@ { + "help" : [ "LogicalProject(DEPTNO=[$1], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(FOUR=[4], DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false } ], "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "4" + }, { "column" : 7, "type" : "INTEGER" }, { "column" : 3, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], + "column" : 2, + "type" : "INTEGER" + } ] + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ] } - } ] + } } - } ], - "help" : [ "LogicalProject(DEPTNO=[$1], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(FOUR=[4], DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughAggregatePermutedConstGroupBy.json b/tests/calcite/testPullConstantThroughAggregatePermutedConstGroupBy.json index 1725adc..5832c7e 100644 --- a/tests/calcite/testPullConstantThroughAggregatePermutedConstGroupBy.json +++ b/tests/calcite/testPullConstantThroughAggregatePermutedConstGroupBy.json @@ -1,202 +1,100 @@ { + "help" : [ "LogicalProject(DEPTNO=[$1], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject($f0=[+(42, 24)], DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "+", - "operand" : [ { - "operator" : "42", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "24", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "+", - "operand" : [ { - "operator" : "42", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "24", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false } ], "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "42" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "24" + } ], + "operator" : "+" + }, { "column" : 7, "type" : "INTEGER" }, { "column" : 3, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], + "column" : 2, + "type" : "INTEGER" + } ] + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ] } - } ] + } } - } ], - "help" : [ "LogicalProject(DEPTNO=[$1], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject($f0=[+(42, 24)], DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughAggregateSimpleNonNullable.json b/tests/calcite/testPullConstantThroughAggregateSimpleNonNullable.json index fc63bfc..eb75134 100644 --- a/tests/calcite/testPullConstantThroughAggregateSimpleNonNullable.json +++ b/tests/calcite/testPullConstantThroughAggregateSimpleNonNullable.json @@ -1,186 +1,92 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(DEPTNO=[$7], FOUR=[4], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "VARCHAR", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "MAX", + "ignoreNulls" : false } ], "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 7, "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "4" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } } } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "VARCHAR" - } ], + "column" : 2, + "type" : "VARCHAR" + } ] + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "VARCHAR", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ] + } } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(DEPTNO=[$7], FOUR=[4], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughConstLast.json b/tests/calcite/testPullConstantThroughConstLast.json index 944342b..9432064 100644 --- a/tests/calcite/testPullConstantThroughConstLast.json +++ b/tests/calcite/testPullConstantThroughConstLast.json @@ -1,186 +1,92 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(DEPTNO=[$7], FOUR=[4], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false } ], "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 7, "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "4" }, { "column" : 3, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], + "column" : 2, + "type" : "INTEGER" + } ] + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ] } - } ] + } } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[MAX($2)])\n LogicalProject(DEPTNO=[$7], FOUR=[4], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(DEPTNO=[$7], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughUnion.json b/tests/calcite/testPullConstantThroughUnion.json index 037968c..d5b5297 100644 --- a/tests/calcite/testPullConstantThroughUnion.json +++ b/tests/calcite/testPullConstantThroughUnion.json @@ -1,91 +1,91 @@ { + "help" : [ "LogicalUnion(all=[true])\n LogicalProject(EXPR$0=[2], DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[2], DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[2], DEPTNO=[$0], JOB=[$1])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "union" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" }, { "column" : 7, "type" : "INTEGER" }, { "column" : 2, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" }, { "column" : 7, "type" : "INTEGER" }, { "column" : 2, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } } ] }, { "project" : { - "target" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "union" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 7, "type" : "INTEGER" }, { "column" : 2, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 7, "type" : "INTEGER" }, { "column" : 2, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } } ] - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalUnion(all=[true])\n LogicalProject(EXPR$0=[2], DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[2], DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[2], DEPTNO=[$0], JOB=[$1])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughUnion3.json b/tests/calcite/testPullConstantThroughUnion3.json index e3d0fb2..b62bdfb 100644 --- a/tests/calcite/testPullConstantThroughUnion3.json +++ b/tests/calcite/testPullConstantThroughUnion3.json @@ -1,81 +1,81 @@ { + "help" : [ "LogicalUnion(all=[true])\n LogicalProject(EXPR$0=[2], EXPR$1=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[2], EXPR$1=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[2], EXPR$1=[3])\n LogicalUnion(all=[true])\n LogicalProject(EXPR$0=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "union" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "3" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "3" + } ] } } ] }, { "project" : { - "target" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "union" : [ { "project" : { - "target" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "scan" : 0 - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ] } }, { "project" : { - "target" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "scan" : 0 - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ] } } ] - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "3" + } ] } - } ], - "help" : [ "LogicalUnion(all=[true])\n LogicalProject(EXPR$0=[2], EXPR$1=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[2], EXPR$1=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[2], EXPR$1=[3])\n LogicalUnion(all=[true])\n LogicalProject(EXPR$0=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EXPR$0=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullConstantThroughUnionSameTypeNullableField.json b/tests/calcite/testPullConstantThroughUnionSameTypeNullableField.json new file mode 100644 index 0000000..26c24b7 --- /dev/null +++ b/tests/calcite/testPullConstantThroughUnionSameTypeNullableField.json @@ -0,0 +1,186 @@ +{ + "help" : [ "LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$1], ENAME=[$0])\n LogicalFilter(condition=[=($1, 1)])\n LogicalProject(ENAME=[$1], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalProject(DEPTNO=[$1], ENAME=[$0])\n LogicalFilter(condition=[=($1, 1)])\n LogicalProject(ENAME=[$1], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(DEPTNO=[CAST(1):INTEGER], ENAME=[$0])\n LogicalUnion(all=[true])\n LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[=($1, 1)])\n LogicalProject(ENAME=[$1], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[=($1, 1)])\n LogicalProject(ENAME=[$1], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n" ], + "schemas" : [ { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, true, true, true, true, true, true, true, true ], + "name" : "CATALOG.SALES.EMPNULLABLES", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + } ], + "queries" : [ { + "union" : [ { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "=" + }, + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "VARCHAR" + } ] + } + }, { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "=" + }, + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "VARCHAR" + } ] + } + } ] + }, { + "project" : { + "source" : { + "union" : [ { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "=" + }, + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ] + } + }, { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "=" + }, + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ] + } + } ] + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "CAST" + }, { + "column" : 0, + "type" : "VARCHAR" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testPullFilterThroughAggregate.json b/tests/calcite/testPullFilterThroughAggregate.json index 82f780e..fd51f3c 100644 --- a/tests/calcite/testPullFilterThroughAggregate.json +++ b/tests/calcite/testPullFilterThroughAggregate.json @@ -1,248 +1,106 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1, 2}])\n LogicalFilter(condition=[>($1, 5000)])\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalFilter(condition=[>($1, 5000)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "5000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ ], + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "5000" + } ], + "operator" : ">" + }, "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "operator" : "5000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ] } } } - } ] + } } }, { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "INTEGER" }, { - "operator" : "5000", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "5000" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 1, "type" : "VARCHAR" }, { - "column" : 1, + "column" : 5, "type" : "INTEGER" }, { - "column" : 2, + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1, 2}])\n LogicalFilter(condition=[>($1, 5000)])\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalFilter(condition=[>($1, 5000)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullFilterThroughAggregateGroupingSets.json b/tests/calcite/testPullFilterThroughAggregateGroupingSets.json index 696f19d..5d0fae5 100644 --- a/tests/calcite/testPullFilterThroughAggregateGroupingSets.json +++ b/tests/calcite/testPullFilterThroughAggregateGroupingSets.json @@ -1,420 +1,121 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1, 2}, {0, 1}, {0}, {}]])\n LogicalFilter(condition=[>($1, 5000)])\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1, 2}, {0, 1}, {0}, {}]])\n LogicalFilter(condition=[>($1, 5000)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "5000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ ], + "column" : 2, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "5000" + } ], + "operator" : ">" + }, "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "operator" : "5000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ] } } } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "5000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ ], + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "5000" + } ], + "operator" : ">" + }, "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { "column" : 1, - "type" : "INTEGER" + "type" : "VARCHAR" }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, + "column" : 5, "type" : "INTEGER" }, { - "column" : 5, + "column" : 7, "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "operator" : "5000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + } ] } } } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1, 2}, {0, 1}, {0}, {}]])\n LogicalFilter(condition=[>($1, 5000)])\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1, 2}], groups=[[{0, 1, 2}, {0, 1}, {0}, {}]])\n LogicalFilter(condition=[>($1, 5000)])\n LogicalAggregate(group=[{0, 1, 2}])\n LogicalProject(ENAME=[$1], SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPullNull.json b/tests/calcite/testPullNull.json index a26a6e5..65a1ea3 100644 --- a/tests/calcite/testPullNull.json +++ b/tests/calcite/testPullNull.json @@ -1,100 +1,69 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 7), =($0, 10), IS NULL($3), =($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[10], ENAME=[$1], JOB=[$2], MGR=[null:INTEGER], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[7], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 7), =($0, 10), IS NULL($3))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { - "operator" : "10", - "operand" : [ ], + "column" : 0, "type" : "INTEGER" }, { "column" : 1, @@ -103,8 +72,7 @@ "column" : 2, "type" : "VARCHAR" }, { - "operator" : "NULL", - "operand" : [ ], + "column" : 3, "type" : "INTEGER" }, { "column" : 4, @@ -116,55 +84,87 @@ "column" : 6, "type" : "INTEGER" }, { - "operator" : "7", - "operand" : [ ], + "column" : 7, "type" : "INTEGER" }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "7" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 7), =($0, 10), IS NULL($3), =($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[10], ENAME=[$1], JOB=[$2], MGR=[null:INTEGER], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[7], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 7), =($0, 10), IS NULL($3))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAboveFiltersIntoInnerJoinCondition.json b/tests/calcite/testPushAboveFiltersIntoInnerJoinCondition.json index 37ca316..efeae46 100644 --- a/tests/calcite/testPushAboveFiltersIntoInnerJoinCondition.json +++ b/tests/calcite/testPushAboveFiltersIntoInnerJoinCondition.json @@ -1,59 +1,26 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalFilter(condition=[>($0, $5)])\n LogicalJoin(condition=[AND(=($0, $9), >($0, $5))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalJoin(condition=[AND(=($0, $9), >($0, $5))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -61,15 +28,14 @@ "column" : 5, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -77,9 +43,9 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -87,23 +53,21 @@ "column" : 5, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -137,14 +101,16 @@ }, { "column" : 10, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -152,9 +118,9 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -162,19 +128,53 @@ "column" : 5, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalFilter(condition=[>($0, $5)])\n LogicalJoin(condition=[AND(=($0, $9), >($0, $5))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalJoin(condition=[AND(=($0, $9), >($0, $5))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateFunctionsThroughJoin.json b/tests/calcite/testPushAggregateFunctionsThroughJoin.json index 4561391..a0591dc 100644 --- a/tests/calcite/testPushAggregateFunctionsThroughJoin.json +++ b/tests/calcite/testPushAggregateFunctionsThroughJoin.json @@ -1,21 +1,107 @@ { + "help" : [ "LogicalProject(JOB=[$0], MIN_SAL=[$2], MIN_DEPTNO=[$3], SUM_SAL_PLUS=[+($4, 1)], MAX_SAL=[$5], SUM_SAL_2=[$4], COUNT_SAL=[$6], COUNT_MGR=[$7])\n LogicalAggregate(group=[{2, 10}], MIN_SAL=[MIN($5)], MIN_DEPTNO=[MIN($7)], SUM_SAL_2=[SUM($5)], MAX_SAL=[MAX($5)], COUNT_SAL=[COUNT()], COUNT_MGR=[COUNT($3)])\n LogicalJoin(condition=[=($2, $10)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(JOB=[$0], MIN_SAL=[$2], MIN_DEPTNO=[$3], SUM_SAL_PLUS=[+($4, 1)], MAX_SAL=[$5], SUM_SAL_2=[$4], COUNT_SAL=[$6], COUNT_MGR=[$7])\n LogicalProject(JOB=[$0], NAME=[$7], MIN_SAL=[$1], MIN_DEPTNO=[$2], $f9=[CAST(*($3, $8)):INTEGER NOT NULL], MAX_SAL=[$4], $f10=[*($5, $8)], $f11=[*($6, $8)])\n LogicalJoin(condition=[=($0, $7)], joinType=[inner])\n LogicalAggregate(group=[{2}], MIN_SAL=[MIN($5)], MIN_DEPTNO=[MIN($7)], SUM_SAL_2=[SUM($5)], MAX_SAL=[MAX($5)], COUNT_SAL=[COUNT()], COUNT_MGR=[COUNT($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "scan" : 1 + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -26,16 +112,16 @@ "column" : 3, "type" : "INTEGER" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 4, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "INTEGER" + "operator" : "+" }, { "column" : 5, "type" : "INTEGER" @@ -48,188 +134,109 @@ }, { "column" : 7, "type" : "BIGINT" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", + "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", + "operator" : "=" + }, + "left" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "column" : 5, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" - }, + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } + "scan" : 0 + } + } + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "scan" : 1 } } } } - } ] - } - } - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "BIGINT" - }, { - "column" : 7, - "type" : "BIGINT" - } ], - "source" : { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -243,9 +250,9 @@ "column" : 2, "type" : "INTEGER" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "*", + "type" : "BIGINT", "operand" : [ { "column" : 3, "type" : "INTEGER" @@ -253,14 +260,14 @@ "column" : 8, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "*" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { "column" : 4, "type" : "INTEGER" }, { - "operator" : "*", + "type" : "BIGINT", "operand" : [ { "column" : 5, "type" : "BIGINT" @@ -268,9 +275,9 @@ "column" : 8, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "*" }, { - "operator" : "*", + "type" : "BIGINT", "operand" : [ { "column" : 6, "type" : "BIGINT" @@ -278,166 +285,43 @@ "column" : 8, "type" : "BIGINT" } ], - "type" : "BIGINT" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } ] - } - } - } - } + "operator" : "*" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "+" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "BIGINT" + }, { + "column" : 7, + "type" : "BIGINT" + } ] } - } ], - "help" : [ "LogicalProject(JOB=[$0], MIN_SAL=[$2], MIN_DEPTNO=[$3], SUM_SAL_PLUS=[+($4, 1)], MAX_SAL=[$5], SUM_SAL_2=[$4], COUNT_SAL=[$6], COUNT_MGR=[$7])\n LogicalAggregate(group=[{2, 10}], MIN_SAL=[MIN($5)], MIN_DEPTNO=[MIN($7)], SUM_SAL_2=[SUM($5)], MAX_SAL=[MAX($5)], COUNT_SAL=[COUNT()], COUNT_MGR=[COUNT($3)])\n LogicalJoin(condition=[=($2, $10)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(JOB=[$0], MIN_SAL=[$2], MIN_DEPTNO=[$3], SUM_SAL_PLUS=[+($4, 1)], MAX_SAL=[$5], SUM_SAL_2=[$4], COUNT_SAL=[$6], COUNT_MGR=[$7])\n LogicalProject(JOB=[$0], NAME=[$7], MIN_SAL=[$1], MIN_DEPTNO=[$2], $f9=[CAST(*($3, $8)):INTEGER NOT NULL], MAX_SAL=[$4], $f10=[*($5, $8)], $f11=[*($6, $8)])\n LogicalJoin(condition=[=($0, $7)], joinType=[inner])\n LogicalAggregate(group=[{2}], MIN_SAL=[MIN($5)], MIN_DEPTNO=[MIN($7)], SUM_SAL_2=[SUM($5)], MAX_SAL=[MAX($5)], COUNT_SAL=[COUNT()], COUNT_MGR=[COUNT($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateSumNoGroup.json b/tests/calcite/testPushAggregateSumNoGroup.json index 84b6d78..73ba240 100644 --- a/tests/calcite/testPushAggregateSumNoGroup.json +++ b/tests/calcite/testPushAggregateSumNoGroup.json @@ -1,370 +1,133 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalJoin(condition=[=($2, $10)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{}], EXPR$0=[$SUM0($0)])\n LogicalProject($f4=[*($1, $3)])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{2}], EXPR$0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "scan" : 1 + } + } + } + } + }, { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "BIGINT" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 2, + "column" : 0, "type" : "VARCHAR" }, { - "column" : 10, + "column" : 2, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "*", - "operand" : [ { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 3, - "type" : "BIGINT" - } ], - "type" : "BIGINT" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } ] - } } } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 0, - "type" : "BIGINT" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" }, - "source" : { - "project" : { - "target" : [ { - "operator" : "*", - "operand" : [ { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 3, - "type" : "BIGINT" - } ], - "type" : "BIGINT" + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } ] - } - } - } + "scan" : 1 } } } } - } + }, + "target" : [ { + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "operator" : "*" + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalJoin(condition=[=($2, $10)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{}], EXPR$0=[$SUM0($0)])\n LogicalProject($f4=[*($1, $3)])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{2}], EXPR$0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], EXPR$0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateSumThroughJoin.json b/tests/calcite/testPushAggregateSumThroughJoin.json index 008c697..b36e061 100644 --- a/tests/calcite/testPushAggregateSumThroughJoin.json +++ b/tests/calcite/testPushAggregateSumThroughJoin.json @@ -1,55 +1,175 @@ { + "help" : [ "LogicalProject(JOB=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{2, 10}], EXPR$1=[SUM($5)])\n LogicalJoin(condition=[=($2, $10)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(JOB=[$0], EXPR$1=[$2])\n LogicalProject(JOB=[$0], NAME=[$2], $f4=[CAST(*($1, $3)):INTEGER NOT NULL])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{2}], EXPR$1=[SUM($5)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + }, + "kind" : "INNER", + "right" : { + "scan" : 1 + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "VARCHAR" }, { "column" : 2, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", + "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" + "column" : 5, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" - }, - "left" : { + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -77,161 +197,32 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } - }, - "right" : { - "scan" : 1 } } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 1 - } - } + "scan" : 1 } } } } - } ] - } - } - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -239,9 +230,9 @@ "column" : 2, "type" : "VARCHAR" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "*", + "type" : "BIGINT", "operand" : [ { "column" : 1, "type" : "INTEGER" @@ -249,222 +240,19 @@ "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "*" } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } ] - } - } - } - } + "operator" : "CAST" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(JOB=[$0], EXPR$1=[$2])\n LogicalAggregate(group=[{2, 10}], EXPR$1=[SUM($5)])\n LogicalJoin(condition=[=($2, $10)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(JOB=[$0], EXPR$1=[$2])\n LogicalProject(JOB=[$0], NAME=[$2], $f4=[CAST(*($1, $3)):INTEGER NOT NULL])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{2}], EXPR$1=[SUM($5)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateSumThroughJoinAfterAggregateReduce.json b/tests/calcite/testPushAggregateSumThroughJoinAfterAggregateReduce.json index 96322bd..9de988b 100644 --- a/tests/calcite/testPushAggregateSumThroughJoinAfterAggregateReduce.json +++ b/tests/calcite/testPushAggregateSumThroughJoinAfterAggregateReduce.json @@ -1,743 +1,291 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($5)])\n LogicalJoin(condition=[=($2, $10)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EXPR$0=[CASE(=($1, 0), null:INTEGER, $0)])\n LogicalAggregate(group=[{}], EXPR$0=[$SUM0($0)], agg#1=[$SUM0($1)])\n LogicalProject($f5=[CAST(*($1, $4)):INTEGER NOT NULL], $f6=[*($2, $4)])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalAggregate(group=[{2}], EXPR$0=[$SUM0($5)], agg#1=[COUNT()])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } + "scan" : 0 } } }, - "right" : { - "scan" : 1 - } + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } + }, + "kind" : "INNER", + "right" : { + "scan" : 1 } } - }, { - "aggregate" : { + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ ], "function" : [ { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 5, + "column" : 0, "type" : "INTEGER" } ], + "operator" : "$SUM0", + "ignoreNulls" : false + }, { "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 2, + "column" : 0, "type" : "VARCHAR" }, { - "column" : 10, + "column" : 3, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { + "group" : { + "keys" : [ { "column" : 2, "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "scan" : 0 - } + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } } } }, + "kind" : "INNER", "right" : { - "scan" : 1 + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "scan" : 1 + } + } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "operator" : "*" + } ], + "operator" : "CAST" + }, { + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "operator" : "*" + } ] } } } - } ] - } - }, { - "project" : { + }, "target" : [ { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" }, { "column" : 0, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "CAST", - "operand" : [ { - "operator" : "*", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "BIGINT" - } ], - "type" : "BIGINT" - } ], - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "column" : 4, - "type" : "BIGINT" - } ], - "type" : "BIGINT" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } ] - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "$SUM0", - "operand" : [ { - "column" : 1, - "type" : "BIGINT" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "CAST", - "operand" : [ { - "operator" : "*", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "BIGINT" - } ], - "type" : "BIGINT" - } ], - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "column" : 4, - "type" : "BIGINT" - } ], - "type" : "BIGINT" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } ] - } - } - } - } - } - } - } - } - } - } ] - } - } + "operator" : "CASE" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($5)])\n LogicalJoin(condition=[=($2, $10)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EXPR$0=[CASE(=($1, 0), null:INTEGER, $0)])\n LogicalAggregate(group=[{}], EXPR$0=[$SUM0($0)], agg#1=[$SUM0($1)])\n LogicalProject($f5=[CAST(*($1, $4)):INTEGER NOT NULL], $f6=[*($2, $4)])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalAggregate(group=[{2}], EXPR$0=[$SUM0($5)], agg#1=[COUNT()])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateSumWithoutGroupKeyThroughJoin.json b/tests/calcite/testPushAggregateSumWithoutGroupKeyThroughJoin.json index bcf7acd..0c4fed5 100644 --- a/tests/calcite/testPushAggregateSumWithoutGroupKeyThroughJoin.json +++ b/tests/calcite/testPushAggregateSumWithoutGroupKeyThroughJoin.json @@ -1,130 +1,169 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($5)])\n LogicalJoin(condition=[=($2, $10)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject($f4=[CAST(*($1, $3)):INTEGER])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{2}], EXPR$0=[SUM($5)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + }, + "kind" : "INNER", + "right" : { + "scan" : 1 + } + } + } + } + }, { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 2, + "column" : 0, "type" : "VARCHAR" }, { - "column" : 10, + "column" : 2, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { + "group" : { + "keys" : [ { "column" : 2, "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", + "function" : [ { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" + "column" : 5, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" - }, - "left" : { + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -152,524 +191,49 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "CAST", - "operand" : [ { - "operator" : "*", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "BIGINT" - } ], - "type" : "BIGINT" - } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } } ] } } } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" }, - "source" : { - "project" : { - "target" : [ { - "operator" : "CAST", - "operand" : [ { - "operator" : "*", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "BIGINT" - } ], - "type" : "BIGINT" - } ], - "type" : "INTEGER" + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } ] - } - } - } + "scan" : 1 } } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "operator" : "*" + } ], + "operator" : "CAST" + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($5)])\n LogicalJoin(condition=[=($2, $10)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject($f4=[CAST(*($1, $3)):INTEGER])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{2}], EXPR$0=[SUM($5)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoin1.json b/tests/calcite/testPushAggregateThroughJoin1.json index 8fce89f..d462002 100644 --- a/tests/calcite/testPushAggregateThroughJoin1.json +++ b/tests/calcite/testPushAggregateThroughJoin1.json @@ -1,211 +1,105 @@ { + "help" : [ "LogicalAggregate(group=[{2, 10}])\n LogicalJoin(condition=[=($2, $10)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "column" : 10, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "project" : { "source" : { - "join" : { - "kind" : "INNER", + "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 4, + "column" : 1, "type" : "VARCHAR" }, { - "column" : 12, - "type" : "VARCHAR" + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "operator" : "=" }, - "right" : { - "scan" : 1 + "source" : { + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } + }, + "kind" : "INNER", + "right" : { + "scan" : 1 } } - } ] + } } }, { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "VARCHAR" @@ -213,187 +107,81 @@ "column" : 1, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { + }, "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ] + } + } + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "scan" : 1 + } } } } - } ], - "help" : [ "LogicalAggregate(group=[{2, 10}])\n LogicalJoin(condition=[=($2, $10)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoin2.json b/tests/calcite/testPushAggregateThroughJoin2.json index a1fe16d..1bd6404 100644 --- a/tests/calcite/testPushAggregateThroughJoin2.json +++ b/tests/calcite/testPushAggregateThroughJoin2.json @@ -1,60 +1,215 @@ { + "help" : [ "LogicalAggregate(group=[{2, 11}])\n LogicalJoin(condition=[AND(=($2, $11), =($9, $12))], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0, 2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[inner])\n LogicalAggregate(group=[{2, 9}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "AND", + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "operator" : "=" + } ], + "operator" : "AND" + }, + "left" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "type" : "INTEGER", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "+" + } ] + } + }, + "kind" : "INNER", + "right" : { + "project" : { + "source" : { + "scan" : 1 }, - "left" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "5" + } ], + "operator" : "+" + } ] + } + } + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "=" + } ], + "operator" : "AND" + }, + "left" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -83,7 +238,7 @@ "column" : 8, "type" : "BOOLEAN" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -91,31 +246,28 @@ "column" : 0, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + "operator" : "+" + } ] } - }, - "right" : { + } + } + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -123,819 +275,23 @@ "column" : 1, "type" : "VARCHAR" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "5", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 13, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 13, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 14, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "operator" : "5" } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } + "operator" : "+" } ] } } } } } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "TIMESTAMP" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - } - } - } - } - } - } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{2, 11}])\n LogicalJoin(condition=[AND(=($2, $11), =($9, $12))], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0, 2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[inner])\n LogicalAggregate(group=[{2, 9}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoin4.json b/tests/calcite/testPushAggregateThroughJoin4.json index 1648704..10f02b3 100644 --- a/tests/calcite/testPushAggregateThroughJoin4.json +++ b/tests/calcite/testPushAggregateThroughJoin4.json @@ -1,108 +1,56 @@ { + "help" : [ "LogicalAggregate(group=[{7}])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } + "group" : { + "keys" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "scan" : 1 } } - } ] + } } }, { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -110,63 +58,38 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] + "group" : { + "keys" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "scan" : 0 + } } }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{7}])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoin5.json b/tests/calcite/testPushAggregateThroughJoin5.json index 50acfe7..9e994b7 100644 --- a/tests/calcite/testPushAggregateThroughJoin5.json +++ b/tests/calcite/testPushAggregateThroughJoin5.json @@ -1,135 +1,70 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], DEPTNO0=[$1])\n LogicalAggregate(group=[{7, 9}])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], DEPTNO0=[$1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } + "group" : { + "keys" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } + "column" : 9, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "scan" : 1 } } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -137,63 +72,41 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] + "group" : { + "keys" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "scan" : 0 + } } }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], DEPTNO0=[$1])\n LogicalAggregate(group=[{7, 9}])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], DEPTNO0=[$1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoin6.json b/tests/calcite/testPushAggregateThroughJoin6.json index 490da35..59acf0a 100644 --- a/tests/calcite/testPushAggregateThroughJoin6.json +++ b/tests/calcite/testPushAggregateThroughJoin6.json @@ -1,438 +1,136 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($9)])\n LogicalJoin(condition=[=($5, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject($f3=[CAST(*($1, $2)):INTEGER])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{5}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { "column" : 9, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "function" : [ ], "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } + "scan" : 0 } } } } - } ] + } } }, { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "operator" : "CAST", + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "*", - "operand" : [ { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 2, + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "group" : { + "keys" : [ { + "column" : 5, "type" : "INTEGER" } ], - "type" : "BIGINT" - } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "scan" : 0 } } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" }, - "source" : { - "project" : { - "target" : [ { - "operator" : "CAST", - "operand" : [ { - "operator" : "*", - "operand" : [ { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BIGINT" - } ], + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 5, "type" : "INTEGER" } ], + "function" : [ ], "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } + "scan" : 0 } } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "*" + } ], + "operator" : "CAST" + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($9)])\n LogicalJoin(condition=[=($5, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject($f3=[CAST(*($1, $2)):INTEGER])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalAggregate(group=[{5}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoin7.json b/tests/calcite/testPushAggregateThroughJoin7.json index 0de612b..75381f6 100644 --- a/tests/calcite/testPushAggregateThroughJoin7.json +++ b/tests/calcite/testPushAggregateThroughJoin7.json @@ -1,388 +1,111 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[ANY_VALUE($9)])\n LogicalJoin(condition=[=($5, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[ANY_VALUE($1)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "ANY_VALUE", + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "ANY_VALUE", + "ignoreNulls" : false + } ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { "column" : 9, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "function" : [ ], "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } + "scan" : 0 } } } } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "ANY_VALUE", + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "ANY_VALUE", + "ignoreNulls" : false + } ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, + "operator" : "=" + }, + "left" : { + "group" : { + "keys" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "scan" : 0 + } + } + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "function" : [ ], "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } + "scan" : 0 } } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[ANY_VALUE($9)])\n LogicalJoin(condition=[=($5, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[ANY_VALUE($1)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoin8.json b/tests/calcite/testPushAggregateThroughJoin8.json index c9a7224..d8763a3 100644 --- a/tests/calcite/testPushAggregateThroughJoin8.json +++ b/tests/calcite/testPushAggregateThroughJoin8.json @@ -1,388 +1,111 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SINGLE_VALUE($9)])\n LogicalJoin(condition=[=($5, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SINGLE_VALUE($1)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SINGLE_VALUE", + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "SINGLE_VALUE", + "ignoreNulls" : false + } ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { "column" : 9, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "function" : [ ], "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } + "scan" : 0 } } } } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SINGLE_VALUE", + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SINGLE_VALUE", + "ignoreNulls" : false + } ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, + "operator" : "=" + }, + "left" : { + "group" : { + "keys" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "scan" : 0 + } + } + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "function" : [ ], "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } + "scan" : 0 } } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SINGLE_VALUE($9)])\n LogicalJoin(condition=[=($5, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SINGLE_VALUE($1)])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{5}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoinDistinct.json b/tests/calcite/testPushAggregateThroughJoinDistinct.json index d3fb6cb..cd76209 100644 --- a/tests/calcite/testPushAggregateThroughJoinDistinct.json +++ b/tests/calcite/testPushAggregateThroughJoinDistinct.json @@ -1,205 +1,80 @@ { + "help" : [ "LogicalAggregate(group=[{9}], SUM_SAL=[SUM($5)], C=[COUNT()])\n LogicalJoin(condition=[=($2, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$3], SUM_SAL=[$1], C=[$2])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalAggregate(group=[{2}], SUM_SAL=[SUM($5)], C=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 9, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } ] - } - } - } - } - } + "group" : { + "keys" : [ { + "column" : 9, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "column" : 6, - "type" : "INTEGER" + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } ] - } - } - } + "scan" : 1 } } } } - } ] + } } }, { "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "BIGINT" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "VARCHAR" @@ -207,108 +82,60 @@ "column" : 3, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "scan" : 0 + } } }, + "kind" : "INNER", "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } ] + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "scan" : 1 + } } } } - } + }, + "target" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{9}], SUM_SAL=[SUM($5)], C=[COUNT()])\n LogicalJoin(condition=[=($2, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$3], SUM_SAL=[$1], C=[$2])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalAggregate(group=[{2}], SUM_SAL=[SUM($5)], C=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoinOnEmptyLogicalValues.json b/tests/calcite/testPushAggregateThroughJoinOnEmptyLogicalValues.json index e92afc3..ba156af 100644 --- a/tests/calcite/testPushAggregateThroughJoinOnEmptyLogicalValues.json +++ b/tests/calcite/testPushAggregateThroughJoinOnEmptyLogicalValues.json @@ -1,433 +1,191 @@ { + "help" : [ "LogicalAggregate(group=[{}], VOLUME=[COUNT()], C1_SUM_SAL=[SUM($0)])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalProject(SAL=[$5], ENAME=[$1])\n LogicalValues(tuples=[[]])\n LogicalProject(ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], VOLUME=[$SUM0($0)], C1_SUM_SAL=[SUM($1)])\n LogicalProject(VOLUME=[$3], $f4=[CAST(*($1, $3)):INTEGER])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$0])\n LogicalProject(SAL=[$5], ENAME=[$1])\n LogicalValues(tuples=[[]])\n LogicalAggregate(group=[{0}], VOLUME=[COUNT()])\n LogicalProject(ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] + } + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] + } + }, + "kind" : "INNER", + "right" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] + } + } + } + } + } + }, { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "BIGINT" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 1, + "column" : 0, "type" : "VARCHAR" }, { "column" : 2, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { - "values" : { - "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "content" : [ ] - } - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "values" : { "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], "content" : [ ] } - } - } - }, - "right" : { - "project" : { + }, "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "BIGINT" - }, { - "operator" : "CAST", - "operand" : [ { - "operator" : "*", - "operand" : [ { + }, + "target" : [ { "column" : 1, - "type" : "INTEGER" + "type" : "VARCHAR" }, { - "column" : 3, - "type" : "BIGINT" + "column" : 0, + "type" : "INTEGER" + } ] + } + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" } ], - "type" : "BIGINT" - } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "values" : { - "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "content" : [ ] - } - } - } - } - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } } ] } } } } } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 0, - "type" : "BIGINT" - } ], - "distinct" : false, - "ignoreNulls" : false, + }, + "target" : [ { + "column" : 3, "type" : "BIGINT" }, { - "operator" : "SUM", + "type" : "INTEGER", "operand" : [ { - "column" : 1, - "type" : "INTEGER" + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "BIGINT" + } ], + "operator" : "*" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "BIGINT" - }, { - "operator" : "CAST", - "operand" : [ { - "operator" : "*", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "BIGINT" - } ], - "type" : "BIGINT" - } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "values" : { - "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "content" : [ ] - } - } - } - } - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } - } - } + "operator" : "CAST" + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], VOLUME=[COUNT()], C1_SUM_SAL=[SUM($0)])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalProject(SAL=[$5], ENAME=[$1])\n LogicalValues(tuples=[[]])\n LogicalProject(ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], VOLUME=[$SUM0($0)], C1_SUM_SAL=[SUM($1)])\n LogicalProject(VOLUME=[$3], $f4=[CAST(*($1, $3)):INTEGER])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$0])\n LogicalProject(SAL=[$5], ENAME=[$1])\n LogicalValues(tuples=[[]])\n LogicalAggregate(group=[{0}], VOLUME=[COUNT()])\n LogicalProject(ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughJoinWithUniqueInput.json b/tests/calcite/testPushAggregateThroughJoinWithUniqueInput.json index 6fffaad..0ff4de3 100644 --- a/tests/calcite/testPushAggregateThroughJoinWithUniqueInput.json +++ b/tests/calcite/testPushAggregateThroughJoinWithUniqueInput.json @@ -1,14 +1,100 @@ { + "help" : [ "LogicalProject(JOB=[$0], MGR0=[$2], DEPTNO=[$1], HIREDATE1=[$3], COMM1=[$4])\n LogicalAggregate(group=[{2, 7, 9}], HIREDATE1=[MAX($11)], COMM1=[SUM($12)])\n LogicalJoin(condition=[=($5, $10)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{3, 5}], HIREDATE1=[MAX($4)], COMM1=[SUM($6)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(JOB=[$0], MGR0=[$2], DEPTNO=[$1], HIREDATE1=[$3], COMM1=[$4])\n LogicalAggregate(group=[{0, 1, 2}], HIREDATE1=[MAX($3)], COMM1=[SUM($4)])\n LogicalProject(JOB=[$0], DEPTNO=[$2], MGR=[$4], HIREDATE1=[$6], $f8=[CAST(*($3, $7)):INTEGER NOT NULL])\n LogicalJoin(condition=[=($1, $5)], joinType=[inner])\n LogicalAggregate(group=[{2, 5, 7}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{3, 5}], HIREDATE1=[MAX($4)], COMM1=[SUM($6)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "TIMESTAMP", + "operand" : [ { + "column" : 11, + "type" : "TIMESTAMP" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "TIMESTAMP", + "operand" : [ { + "column" : 4, + "type" : "TIMESTAMP" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "scan" : 0 + } + } + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -24,271 +110,147 @@ }, { "column" : 4, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "TIMESTAMP", + "operand" : [ { + "column" : 3, + "type" : "TIMESTAMP" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 5, + "column" : 1, "type" : "INTEGER" }, { - "column" : 10, + "column" : 5, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "scan" : 0 - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 6, - "type" : "TIMESTAMP" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "TIMESTAMP" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 14, - "type" : "TIMESTAMP" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "TIMESTAMP" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 15, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, + "group" : { + "keys" : [ { + "column" : 2, "type" : "VARCHAR" }, { "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, "type" : "INTEGER" }, { - "column" : 10, + "column" : 7, "type" : "INTEGER" } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "scan" : 0 + } + } + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 3, "type" : "INTEGER" }, { - "column" : 12, + "column" : 5, "type" : "INTEGER" } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", + "function" : [ { + "distinct" : false, + "type" : "TIMESTAMP", "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 13, + "column" : 4, + "type" : "TIMESTAMP" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 6, "type" : "INTEGER" } ], - "type" : "BOOLEAN" - }, - "left" : { + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "scan" : 0 - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 9, - "type" : "TIMESTAMP" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "TIMESTAMP" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 11, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BIGINT", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "*" + } ], + "operator" : "CAST" + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -304,471 +266,7 @@ }, { "column" : 4, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "operator" : "CAST", - "operand" : [ { - "operator" : "*", - "operand" : [ { - "column" : 3, - "type" : "BIGINT" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BIGINT" - } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 6, - "type" : "TIMESTAMP" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "TIMESTAMP" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 6, - "type" : "TIMESTAMP" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "TIMESTAMP" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "TIMESTAMP" - }, { - "operator" : "CAST", - "operand" : [ { - "operator" : "*", - "operand" : [ { - "column" : 6, - "type" : "BIGINT" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BIGINT" - } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 9, - "type" : "TIMESTAMP" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "TIMESTAMP" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 11, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalProject(JOB=[$0], MGR0=[$2], DEPTNO=[$1], HIREDATE1=[$3], COMM1=[$4])\n LogicalAggregate(group=[{2, 7, 9}], HIREDATE1=[MAX($11)], COMM1=[SUM($12)])\n LogicalJoin(condition=[=($5, $10)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{3, 5}], HIREDATE1=[MAX($4)], COMM1=[SUM($6)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(JOB=[$0], MGR0=[$2], DEPTNO=[$1], HIREDATE1=[$3], COMM1=[$4])\n LogicalAggregate(group=[{0, 1, 2}], HIREDATE1=[MAX($3)], COMM1=[SUM($4)])\n LogicalProject(JOB=[$0], DEPTNO=[$2], MGR=[$4], HIREDATE1=[$6], $f8=[CAST(*($3, $7)):INTEGER NOT NULL])\n LogicalJoin(condition=[=($1, $5)], joinType=[inner])\n LogicalAggregate(group=[{2, 5, 7}], agg#0=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{3, 5}], HIREDATE1=[MAX($4)], COMM1=[SUM($6)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin1.json b/tests/calcite/testPushAggregateThroughOuterJoin1.json index f7b2e7a..55519bc 100644 --- a/tests/calcite/testPushAggregateThroughOuterJoin1.json +++ b/tests/calcite/testPushAggregateThroughOuterJoin1.json @@ -1,43 +1,149 @@ { + "help" : [ "LogicalAggregate(group=[{1}])\n LogicalJoin(condition=[=($2, $10)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } }, - "left" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + }, + "kind" : "LEFT", + "right" : { + "scan" : 1 + } + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -65,577 +171,26 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } } ] } } } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "TIMESTAMP" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } ] - } - } - } + "scan" : 1 } } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{1}])\n LogicalJoin(condition=[=($2, $10)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin12.json b/tests/calcite/testPushAggregateThroughOuterJoin12.json index bff3d7e..f874fea 100644 --- a/tests/calcite/testPushAggregateThroughOuterJoin12.json +++ b/tests/calcite/testPushAggregateThroughOuterJoin12.json @@ -1,43 +1,146 @@ { + "help" : [ "LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[=($2, $10)], joinType=[right])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } }, - "left" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + }, + "kind" : "RIGHT", + "right" : { + "scan" : 1 + } + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -65,551 +168,26 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } } ] } } } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + }, + "kind" : "RIGHT", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } ] - } - } - } + "scan" : 1 } } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[=($2, $10)], joinType=[right])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[right])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin13.json b/tests/calcite/testPushAggregateThroughOuterJoin13.json index cc56464..590d5bc 100644 --- a/tests/calcite/testPushAggregateThroughOuterJoin13.json +++ b/tests/calcite/testPushAggregateThroughOuterJoin13.json @@ -1,43 +1,146 @@ { + "help" : [ "LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[=($2, $10)], joinType=[full])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[full])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } }, - "left" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + }, + "kind" : "FULL", + "right" : { + "scan" : 1 + } + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -65,551 +168,26 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } } ] } } } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + }, + "kind" : "FULL", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } ] - } - } - } + "scan" : 1 } } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[=($2, $10)], joinType=[full])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[=($0, $1)], joinType=[full])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin14.json b/tests/calcite/testPushAggregateThroughOuterJoin14.json index dd05548..0657e83 100644 --- a/tests/calcite/testPushAggregateThroughOuterJoin14.json +++ b/tests/calcite/testPushAggregateThroughOuterJoin14.json @@ -1,390 +1,140 @@ { + "help" : [ "LogicalProject(MGR=[$1], MGR0=[$0])\n LogicalProject(MGR0=[$1], MGR=[$0])\n LogicalAggregate(group=[{3, 12}])\n LogicalJoin(condition=[=($3, $12)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(MGR=[$1], MGR0=[$0])\n LogicalProject(MGR0=[$1], MGR=[$0])\n LogicalAggregate(group=[{0, 1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[full])\n LogicalAggregate(group=[{3}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{3}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "FULL", + "right" : { + "scan" : 0 + } + } + } + } + }, "target" : [ { "column" : 1, "type" : "INTEGER" }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 14, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 14, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + } ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "INTEGER" }, { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "group" : { + "keys" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "scan" : 0 } } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + }, + "kind" : "FULL", + "right" : { + "group" : { + "keys" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "function" : [ ], "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } + "scan" : 0 } } } } - } ] + } } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ] } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(MGR=[$1], MGR0=[$0])\n LogicalProject(MGR0=[$1], MGR=[$0])\n LogicalAggregate(group=[{3, 12}])\n LogicalJoin(condition=[=($3, $12)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(MGR=[$1], MGR0=[$0])\n LogicalProject(MGR0=[$1], MGR=[$0])\n LogicalAggregate(group=[{0, 1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[full])\n LogicalAggregate(group=[{3}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{3}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin15.json b/tests/calcite/testPushAggregateThroughOuterJoin15.json index b3abbee..b3dd99e 100644 --- a/tests/calcite/testPushAggregateThroughOuterJoin15.json +++ b/tests/calcite/testPushAggregateThroughOuterJoin15.json @@ -1,39 +1,148 @@ { + "help" : [ "LogicalAggregate(group=[{1, 12}])\n LogicalJoin(condition=[=($2, $11)], joinType=[full])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 3}])\n LogicalJoin(condition=[=($1, $2)], joinType=[full])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{2, 3}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } }, - "left" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + }, + "kind" : "FULL", + "right" : { + "scan" : 0 + } + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -61,626 +170,29 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 14, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 13, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } } ] } } } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + }, + "kind" : "FULL", + "right" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "function" : [ ], "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "TIMESTAMP" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } + "scan" : 0 } } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{1, 12}])\n LogicalJoin(condition=[=($2, $11)], joinType=[full])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 3}])\n LogicalJoin(condition=[=($1, $2)], joinType=[full])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{2, 3}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin16.json b/tests/calcite/testPushAggregateThroughOuterJoin16.json index 5d06c6f..3e31d88 100644 --- a/tests/calcite/testPushAggregateThroughOuterJoin16.json +++ b/tests/calcite/testPushAggregateThroughOuterJoin16.json @@ -1,57 +1,209 @@ { + "help" : [ "LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[AND(=($2, $11), =($9, $12))], joinType=[full])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[full])\n LogicalAggregate(group=[{2, 9}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "AND", + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "operator" : "=" + } ], + "operator" : "AND" + }, + "left" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "type" : "INTEGER", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "+" + } ] + } + }, + "kind" : "FULL", + "right" : { + "project" : { + "source" : { + "scan" : 1 }, - "left" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "5" + } ], + "operator" : "+" + } ] + } + } + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "=" + } ], + "operator" : "AND" + }, + "left" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -80,7 +232,7 @@ "column" : 8, "type" : "BOOLEAN" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -88,31 +240,28 @@ "column" : 0, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + "operator" : "+" + } ] } - }, - "right" : { + } + } + }, + "kind" : "FULL", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -120,796 +269,23 @@ "column" : 1, "type" : "VARCHAR" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "5", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "5" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } + "operator" : "+" } ] } } } } } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "TIMESTAMP" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - } - } - } - } - } - } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[AND(=($2, $11), =($9, $12))], joinType=[full])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[full])\n LogicalAggregate(group=[{2, 9}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin2.json b/tests/calcite/testPushAggregateThroughOuterJoin2.json index 93b7880..5d4f9a8 100644 --- a/tests/calcite/testPushAggregateThroughOuterJoin2.json +++ b/tests/calcite/testPushAggregateThroughOuterJoin2.json @@ -1,36 +1,139 @@ { + "help" : [ "LogicalAggregate(group=[{10}])\n LogicalJoin(condition=[=($2, $11)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{1}])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1, 2}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 10, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "group" : { + "keys" : [ { + "column" : 10, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } }, - "left" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + }, + "kind" : "LEFT", + "right" : { + "scan" : 0 + } + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -58,577 +161,29 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } } ] } } } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } + "scan" : 0 } } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{10}])\n LogicalJoin(condition=[=($2, $11)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{1}])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1, 2}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin3.json b/tests/calcite/testPushAggregateThroughOuterJoin3.json index 3d66d61..89d45bd 100644 --- a/tests/calcite/testPushAggregateThroughOuterJoin3.json +++ b/tests/calcite/testPushAggregateThroughOuterJoin3.json @@ -1,39 +1,148 @@ { + "help" : [ "LogicalAggregate(group=[{1, 12}])\n LogicalJoin(condition=[=($2, $11)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 3}])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{2, 3}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } }, - "left" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + }, + "kind" : "LEFT", + "right" : { + "scan" : 0 + } + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -61,626 +170,29 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 14, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 13, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } } ] } } } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "function" : [ ], "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "TIMESTAMP" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } + "scan" : 0 } } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{1, 12}])\n LogicalJoin(condition=[=($2, $11)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 3}])\n LogicalJoin(condition=[=($1, $2)], joinType=[left])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{2, 3}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin4.json b/tests/calcite/testPushAggregateThroughOuterJoin4.json index ac27434..96d2b8b 100644 --- a/tests/calcite/testPushAggregateThroughOuterJoin4.json +++ b/tests/calcite/testPushAggregateThroughOuterJoin4.json @@ -1,204 +1,104 @@ { + "help" : [ "LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[=($2, $10)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(JOB=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "project" : { "source" : { - "join" : { - "kind" : "LEFT", + "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 3, + "column" : 1, "type" : "VARCHAR" }, { - "column" : 11, - "type" : "VARCHAR" + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "operator" : "=" }, - "right" : { - "scan" : 1 + "source" : { + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } + }, + "kind" : "LEFT", + "right" : { + "scan" : 1 } } - } ] + } } }, { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "VARCHAR" @@ -206,189 +106,87 @@ "column" : 1, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { + }, "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ] + } + } + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "scan" : 1 + } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[=($2, $10)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(JOB=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin5.json b/tests/calcite/testPushAggregateThroughOuterJoin5.json index bae1df4..84af362 100644 --- a/tests/calcite/testPushAggregateThroughOuterJoin5.json +++ b/tests/calcite/testPushAggregateThroughOuterJoin5.json @@ -1,43 +1,146 @@ { + "help" : [ "LogicalAggregate(group=[{10}])\n LogicalJoin(condition=[=($2, $10)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 10, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "group" : { + "keys" : [ { + "column" : 10, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } }, - "left" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + }, + "kind" : "LEFT", + "right" : { + "scan" : 1 + } + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -65,551 +168,26 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } } ] } } } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } ] - } - } - } + "scan" : 1 } } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{10}])\n LogicalJoin(condition=[=($2, $10)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{1}])\n LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin6.json b/tests/calcite/testPushAggregateThroughOuterJoin6.json index 35512dc..ada57ac 100644 --- a/tests/calcite/testPushAggregateThroughOuterJoin6.json +++ b/tests/calcite/testPushAggregateThroughOuterJoin6.json @@ -1,211 +1,105 @@ { + "help" : [ "LogicalAggregate(group=[{2, 10}])\n LogicalJoin(condition=[=($2, $10)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "column" : 10, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "project" : { "source" : { - "join" : { - "kind" : "LEFT", + "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 4, + "column" : 1, "type" : "VARCHAR" }, { - "column" : 12, - "type" : "VARCHAR" + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "operator" : "=" }, - "right" : { - "scan" : 1 + "source" : { + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } + }, + "kind" : "LEFT", + "right" : { + "scan" : 1 } } - } ] + } } }, { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "VARCHAR" @@ -213,187 +107,81 @@ "column" : 1, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { + }, "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ] + } + } + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "scan" : 1 + } } } } - } ], - "help" : [ "LogicalAggregate(group=[{2, 10}])\n LogicalJoin(condition=[=($2, $10)], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalJoin(condition=[=($0, $1)], joinType=[left])\n LogicalAggregate(group=[{2}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1}])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin7.json b/tests/calcite/testPushAggregateThroughOuterJoin7.json index 1f7b152..d92798d 100644 --- a/tests/calcite/testPushAggregateThroughOuterJoin7.json +++ b/tests/calcite/testPushAggregateThroughOuterJoin7.json @@ -1,57 +1,209 @@ { + "help" : [ "LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[AND(=($2, $11), =($9, $12))], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalAggregate(group=[{2, 9}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "AND", + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "operator" : "=" + } ], + "operator" : "AND" + }, + "left" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "type" : "INTEGER", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "+" + } ] + } + }, + "kind" : "LEFT", + "right" : { + "project" : { + "source" : { + "scan" : 1 }, - "left" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "5" + } ], + "operator" : "+" + } ] + } + } + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "=" + } ], + "operator" : "AND" + }, + "left" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -80,7 +232,7 @@ "column" : 8, "type" : "BOOLEAN" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -88,31 +240,28 @@ "column" : 0, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + "operator" : "+" + } ] } - }, - "right" : { + } + } + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -120,796 +269,23 @@ "column" : 1, "type" : "VARCHAR" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "5", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "5" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } + "operator" : "+" } ] } } } } } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "TIMESTAMP" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - } - } - } - } - } - } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[AND(=($2, $11), =($9, $12))], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalAggregate(group=[{2, 9}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin8.json b/tests/calcite/testPushAggregateThroughOuterJoin8.json index 817b738..cc4980e 100644 --- a/tests/calcite/testPushAggregateThroughOuterJoin8.json +++ b/tests/calcite/testPushAggregateThroughOuterJoin8.json @@ -1,57 +1,209 @@ { + "help" : [ "LogicalAggregate(group=[{11}])\n LogicalJoin(condition=[AND(=($2, $11), =($9, $12))], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalAggregate(group=[{2, 9}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 11, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "AND", + "group" : { + "keys" : [ { + "column" : 11, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "operator" : "=" + } ], + "operator" : "AND" + }, + "left" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "type" : "INTEGER", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "+" + } ] + } + }, + "kind" : "LEFT", + "right" : { + "project" : { + "source" : { + "scan" : 1 }, - "left" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "5" + } ], + "operator" : "+" + } ] + } + } + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "=" + } ], + "operator" : "AND" + }, + "left" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -80,7 +232,7 @@ "column" : 8, "type" : "BOOLEAN" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -88,31 +240,28 @@ "column" : 0, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + "operator" : "+" + } ] } - }, - "right" : { + } + } + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -120,796 +269,23 @@ "column" : 1, "type" : "VARCHAR" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "5", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "operator" : "5" } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } + "operator" : "+" } ] } } } } } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "TIMESTAMP" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - } - } - } - } - } - } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{11}])\n LogicalJoin(condition=[AND(=($2, $11), =($9, $12))], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalAggregate(group=[{2, 9}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAggregateThroughOuterJoin9.json b/tests/calcite/testPushAggregateThroughOuterJoin9.json index 8f00d9f..74894d3 100644 --- a/tests/calcite/testPushAggregateThroughOuterJoin9.json +++ b/tests/calcite/testPushAggregateThroughOuterJoin9.json @@ -1,60 +1,215 @@ { + "help" : [ "LogicalAggregate(group=[{2, 11}])\n LogicalJoin(condition=[AND(=($2, $11), =($9, $12))], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0, 2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalAggregate(group=[{2, 9}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "AND", + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "operator" : "=" + } ], + "operator" : "AND" + }, + "left" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "type" : "INTEGER", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "+" + } ] + } + }, + "kind" : "LEFT", + "right" : { + "project" : { + "source" : { + "scan" : 1 }, - "left" : { + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "5" + } ], + "operator" : "+" + } ] + } + } + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "=" + } ], + "operator" : "AND" + }, + "left" : { + "group" : { + "keys" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'A'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -83,7 +238,7 @@ "column" : 8, "type" : "BOOLEAN" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -91,31 +246,28 @@ "column" : 0, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + "operator" : "+" + } ] } - }, - "right" : { + } + } + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -123,819 +275,23 @@ "column" : 1, "type" : "VARCHAR" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "5", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 13, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 13, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 14, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "operator" : "5" } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } + "operator" : "+" } ] } } } } } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "TIMESTAMP" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'A'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "operator" : "+", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - } - } - } - } - } - } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{2, 11}])\n LogicalJoin(condition=[AND(=($2, $11), =($9, $12))], joinType=[left])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0, 2}])\n LogicalJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[left])\n LogicalAggregate(group=[{2, 9}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, $0)])\n LogicalFilter(condition=[=($1, 'A')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{1, 2}])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 5)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAvgGroupingSetsThroughUnion.json b/tests/calcite/testPushAvgGroupingSetsThroughUnion.json index 1951111..64e620d 100644 --- a/tests/calcite/testPushAvgGroupingSetsThroughUnion.json +++ b/tests/calcite/testPushAvgGroupingSetsThroughUnion.json @@ -1,364 +1,172 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[AVG($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[AVG($2)])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "AVG", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "union" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 7, + "column" : 0, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" }, { "column" : 2, "type" : "VARCHAR" }, { - "column" : 0, + "column" : 3, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 7, + "column" : 0, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" }, { "column" : 2, "type" : "VARCHAR" }, { - "column" : 0, + "column" : 3, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } } ] - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "AVG", - "operand" : [ { - "column" : 4, + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] } - } - } ] + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[AVG($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[AVG($2)])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushAvgThroughUnion.json b/tests/calcite/testPushAvgThroughUnion.json index 65e7af0..b640281 100644 --- a/tests/calcite/testPushAvgThroughUnion.json +++ b/tests/calcite/testPushAvgThroughUnion.json @@ -1,320 +1,157 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[AVG($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[AVG($1)])\n LogicalUnion(all=[true])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "AVG", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { "union" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { "column" : 1, "type" : "VARCHAR" }, { - "column" : 0, + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { "column" : 1, "type" : "VARCHAR" }, { - "column" : 0, + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } } ] - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] } - }, { - "aggregate" : { - "function" : [ { - "operator" : "AVG", - "operand" : [ { - "column" : 2, + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } + } ] } - } - } ] + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[AVG($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[AVG($1)])\n LogicalUnion(all=[true])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushBoolAndBoolOrThroughUnion.json b/tests/calcite/testPushBoolAndBoolOrThroughUnion.json index b5e5cdb..2dd8f57 100644 --- a/tests/calcite/testPushBoolAndBoolOrThroughUnion.json +++ b/tests/calcite/testPushBoolAndBoolOrThroughUnion.json @@ -1,692 +1,240 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($1)])\n LogicalUnion(all=[true])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($1)])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($1)])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + } ], + "operator" : "BOOL_AND", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + } ], + "operator" : "BOOL_OR", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ], + "operator" : "MOD" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "=" + } ] + } + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ], + "operator" : "MOD" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "=" + } ] + } + } ] + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + } ], + "operator" : "BOOL_AND", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + } ], + "operator" : "BOOL_OR", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + } ], + "operator" : "BOOL_AND", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + } ], + "operator" : "BOOL_OR", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "MOD", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "INTEGER" + "operator" : "MOD" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + "operator" : "=" + } ] } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + } ], + "operator" : "BOOL_AND", + "ignoreNulls" : false }, { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + } ], + "operator" : "BOOL_OR", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "MOD", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "INTEGER" + "operator" : "MOD" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "BOOL_AND", - "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BOOLEAN" - }, { - "operator" : "BOOL_OR", - "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "=", - "operand" : [ { - "operator" : "MOD", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "=", - "operand" : [ { - "operator" : "MOD", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "operator" : "=" } ] } } } - } - } ] + } ] + } } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "=", - "operand" : [ { - "operator" : "MOD", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "BOOL_AND", - "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BOOLEAN" - }, { - "operator" : "BOOL_OR", - "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "=", - "operand" : [ { - "operator" : "MOD", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "=", - "operand" : [ { - "operator" : "MOD", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "BOOL_AND", - "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BOOLEAN" - }, { - "operator" : "BOOL_OR", - "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "=", - "operand" : [ { - "operator" : "MOD", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } ] - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "BOOL_AND", - "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BOOLEAN" - }, { - "operator" : "BOOL_OR", - "operand" : [ { - "column" : 3, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "=", - "operand" : [ { - "operator" : "MOD", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "BOOL_AND", - "operand" : [ { - "column" : 3, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BOOLEAN" - }, { - "operator" : "BOOL_OR", - "operand" : [ { - "column" : 3, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "=", - "operand" : [ { - "operator" : "MOD", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "=", - "operand" : [ { - "operator" : "MOD", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "BOOL_AND", - "operand" : [ { - "column" : 3, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BOOLEAN" - }, { - "operator" : "BOOL_OR", - "operand" : [ { - "column" : 3, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "=", - "operand" : [ { - "operator" : "MOD", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } ] - } - } - } - } - } ] - } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($1)])\n LogicalUnion(all=[true])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($1)])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[BOOL_AND($1)], EXPR$2=[BOOL_OR($1)])\n LogicalProject(ENAME=[$1], EMPBOL=[=(MOD($0, 2), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushCountFilterThroughUnion.json b/tests/calcite/testPushCountFilterThroughUnion.json index 6784b99..50c153e 100644 --- a/tests/calcite/testPushCountFilterThroughUnion.json +++ b/tests/calcite/testPushCountFilterThroughUnion.json @@ -1,809 +1,272 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT() FILTER $1])\n LogicalProject(DEPTNO=[$7], $f1=[=($2, 'CLERK')])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT() FILTER $1])\n LogicalProject(DEPTNO=[$7], $f1=[=($2, 'CLERK')])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT() FILTER $1])\n LogicalProject(DEPTNO=[$7], $f1=[=($2, 'CLERK')])\n LogicalFilter(condition=[>($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'CLERK'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], + "union" : [ { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } + "scan" : 0 } } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + }, { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : ">" + }, "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } + "scan" : 0 } } - } ] - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'CLERK'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } + } ] } - } - } + } ] + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'CLERK'" + } ], + "operator" : "=" + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'CLERK'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'CLERK'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'CLERK'" + } ], + "operator" : "=" } ] } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : ">" + }, "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'CLERK'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'CLERK'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - } ] - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 0, - "type" : "INTEGER" + "column" : 2, + "type" : "VARCHAR" }, { - "column" : 1, - "type" : "INTEGER" + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'CLERK'" } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'CLERK'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'CLERK'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'CLERK'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'CLERK'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } + "operator" : "=" } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT() FILTER $1])\n LogicalProject(DEPTNO=[$7], $f1=[=($2, 'CLERK')])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT() FILTER $1])\n LogicalProject(DEPTNO=[$7], $f1=[=($2, 'CLERK')])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT() FILTER $1])\n LogicalProject(DEPTNO=[$7], $f1=[=($2, 'CLERK')])\n LogicalFilter(condition=[>($7, 20)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushCountNullableGroupingSetsThroughUnion.json b/tests/calcite/testPushCountNullableGroupingSetsThroughUnion.json index a8d10b3..84eff4d 100644 --- a/tests/calcite/testPushCountNullableGroupingSetsThroughUnion.json +++ b/tests/calcite/testPushCountNullableGroupingSetsThroughUnion.json @@ -1,660 +1,214 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[$SUM0($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" } ] } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } + } ] } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { + } ] + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" }, { - "column" : 1, + "column" : 2, "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + }, { + "column" : 3, + "type" : "INTEGER" + } ] + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" } ] } - } ] + } } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 4, - "type" : "BIGINT" + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 2, + "type" : "VARCHAR" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 3, + "type" : "INTEGER" } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[$SUM0($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushCountNullableThroughUnion.json b/tests/calcite/testPushCountNullableThroughUnion.json index b494f6e..ecd1110 100644 --- a/tests/calcite/testPushCountNullableThroughUnion.json +++ b/tests/calcite/testPushCountNullableThroughUnion.json @@ -1,552 +1,193 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" } ] } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } + } ] } - } - } + } ] + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 3, + "type" : "INTEGER" } ] } - } ] + } } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 3, + "type" : "INTEGER" } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushCountStarGroupingSetsThroughUnion.json b/tests/calcite/testPushCountStarGroupingSetsThroughUnion.json index 5cb43fa..1817bd2 100644 --- a/tests/calcite/testPushCountStarGroupingSetsThroughUnion.json +++ b/tests/calcite/testPushCountStarGroupingSetsThroughUnion.json @@ -1,615 +1,196 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT()])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[$SUM0($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" } ] } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } + } ] } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { + } ] + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" }, { - "column" : 1, + "column" : 2, "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + } ] + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 2, + "type" : "VARCHAR" } ] } - } ] + } } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 4, - "type" : "BIGINT" + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 2, + "type" : "VARCHAR" } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[COUNT()])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[$SUM0($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(DEPTNO=[$7], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushCountStarThroughUnion.json b/tests/calcite/testPushCountStarThroughUnion.json index e9bedac..2b08eb5 100644 --- a/tests/calcite/testPushCountStarThroughUnion.json +++ b/tests/calcite/testPushCountStarThroughUnion.json @@ -1,507 +1,175 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(ENAME=[$1])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" } ] } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } + } ] } - } - } + } ] + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 1, + "type" : "BIGINT" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" } ] } - } ] + } } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(ENAME=[$1])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[$SUM0($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(ENAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushFilterPastAgg.json b/tests/calcite/testPushFilterPastAgg.json index d199f27..ae939e9 100644 --- a/tests/calcite/testPushFilterPastAgg.json +++ b/tests/calcite/testPushFilterPastAgg.json @@ -1,206 +1,116 @@ { + "help" : [ "LogicalProject(DNAME=[$0], C=[$1])\n LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalAggregate(group=[{0}], C=[COUNT()])\n LogicalProject(DNAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DNAME=[$0], C=[$1])\n LogicalAggregate(group=[{0}], C=[COUNT()])\n LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalProject(DNAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'Charlie'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'Charlie'" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } + } ] } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] + } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" }, { "column" : 1, "type" : "BIGINT" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'Charlie'" + } ], + "operator" : "=" + }, "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'Charlie'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "scan" : 0 }, - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'Charlie'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } } } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "BIGINT" + } ] } - } ], - "help" : [ "LogicalProject(DNAME=[$0], C=[$1])\n LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalAggregate(group=[{0}], C=[COUNT()])\n LogicalProject(DNAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DNAME=[$0], C=[$1])\n LogicalAggregate(group=[{0}], C=[COUNT()])\n LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalProject(DNAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushFilterPastAggFour.json b/tests/calcite/testPushFilterPastAggFour.json index 4a03ab6..f4cf3ff 100644 --- a/tests/calcite/testPushFilterPastAggFour.json +++ b/tests/calcite/testPushFilterPastAggFour.json @@ -1,442 +1,124 @@ { + "help" : [ "LogicalAggregate(group=[{1}], EXPR$1=[$SUM0($2)])\n LogicalFilter(condition=[>($0, CAST('12'):INTEGER NOT NULL)])\n LogicalAggregate(group=[{5, 7}], EXPR$1=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{1}], EXPR$1=[$SUM0($2)])\n LogicalAggregate(group=[{5, 7}], EXPR$1=[COUNT()])\n LogicalFilter(condition=[>($5, 12)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "CAST", - "operand" : [ { - "operator" : "_ISO-8859-1'12'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", + "group" : { + "keys" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + } ], + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "column" : 3, - "type" : "BIGINT" + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'12'" + } ], + "operator" : "CAST" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], + "operator" : ">" + }, "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "group" : { + "keys" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "CAST", - "operand" : [ { - "operator" : "_ISO-8859-1'12'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } ] - } - } - } + "scan" : 0 } } } } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, + "group" : { + "keys" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + } ], + "source" : { + "group" : { + "keys" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, "type" : "INTEGER" } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "12", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "12", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 3, - "type" : "BIGINT" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "12" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "12", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "12", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "scan" : 0 } } } } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{1}], EXPR$1=[$SUM0($2)])\n LogicalFilter(condition=[>($0, CAST('12'):INTEGER NOT NULL)])\n LogicalAggregate(group=[{5, 7}], EXPR$1=[COUNT()])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{1}], EXPR$1=[$SUM0($2)])\n LogicalAggregate(group=[{5, 7}], EXPR$1=[COUNT()])\n LogicalFilter(condition=[>($5, 12)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushFilterPastAggTwo.json b/tests/calcite/testPushFilterPastAggTwo.json index f415968..698224b 100644 --- a/tests/calcite/testPushFilterPastAggTwo.json +++ b/tests/calcite/testPushFilterPastAggTwo.json @@ -1,325 +1,203 @@ { + "help" : [ "LogicalProject(C1=[$0])\n LogicalFilter(condition=[AND(>($0, 'c'), OR(>($1, 30), <($0, 'z')))])\n LogicalAggregate(group=[{0}], C2=[COUNT()])\n LogicalProject(C1=[$1])\n LogicalFilter(condition=[>($1, 'b')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(C1=[$0])\n LogicalFilter(condition=[OR(>($1, 30), <($0, 'z'))])\n LogicalAggregate(group=[{0}], C2=[COUNT()])\n LogicalFilter(condition=[>($0, 'c')])\n LogicalProject(C1=[$1])\n LogicalFilter(condition=[>($1, 'b')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'c'", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "_ISO-8859-1'c'" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "BIGINT" }, { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'z'", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "_ISO-8859-1'z'" } ], - "type" : "BOOLEAN" + "operator" : "<" } ], - "type" : "BOOLEAN" + "operator" : "OR" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'b'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'b'" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'b'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ] + } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "BIGINT" }, { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'z'", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "_ISO-8859-1'z'" } ], - "type" : "BOOLEAN" + "operator" : "<" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'c'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'b'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'c'" + } ], + "operator" : ">" + }, "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'c'", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "_ISO-8859-1'b'" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'b'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } } } - } ] + } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(C1=[$0])\n LogicalFilter(condition=[AND(>($0, 'c'), OR(>($1, 30), <($0, 'z')))])\n LogicalAggregate(group=[{0}], C2=[COUNT()])\n LogicalProject(C1=[$1])\n LogicalFilter(condition=[>($1, 'b')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(C1=[$0])\n LogicalFilter(condition=[OR(>($1, 30), <($0, 'z'))])\n LogicalAggregate(group=[{0}], C2=[COUNT()])\n LogicalFilter(condition=[>($0, 'c')])\n LogicalProject(C1=[$1])\n LogicalFilter(condition=[>($1, 'b')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushFilterPastAggWithGroupingSets2.json b/tests/calcite/testPushFilterPastAggWithGroupingSets2.json index ceeb102..9e506fb 100644 --- a/tests/calcite/testPushFilterPastAggWithGroupingSets2.json +++ b/tests/calcite/testPushFilterPastAggWithGroupingSets2.json @@ -1,125 +1,63 @@ { + "help" : [ "LogicalProject(DNAME=[$0], DDEPTNO=[$1], C=[$2])\n LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]], C=[COUNT()])\n LogicalProject(DNAME=[$1], DDEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DNAME=[$0], DDEPTNO=[$1], C=[$2])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]], C=[COUNT()])\n LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalProject(DNAME=[$1], DDEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'Charlie'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'Charlie'" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 1, "type" : "VARCHAR" }, { - "column" : 1, + "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + } ] } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] + } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -129,122 +67,68 @@ }, { "column" : 2, "type" : "BIGINT" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'Charlie'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'Charlie'" + } ], + "operator" : "=" + }, "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'Charlie'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] } } } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + } ] } - } ], - "help" : [ "LogicalProject(DNAME=[$0], DDEPTNO=[$1], C=[$2])\n LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]], C=[COUNT()])\n LogicalProject(DNAME=[$1], DDEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DNAME=[$0], DDEPTNO=[$1], C=[$2])\n LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}]], C=[COUNT()])\n LogicalFilter(condition=[=($0, 'Charlie')])\n LogicalProject(DNAME=[$1], DDEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushFilterPastProject.json b/tests/calcite/testPushFilterPastProject.json index 25f1973..aaaabd4 100644 --- a/tests/calcite/testPushFilterPastProject.json +++ b/tests/calcite/testPushFilterPastProject.json @@ -1,54 +1,25 @@ { + "help" : [ "LogicalProject(NAME=[$1])\n LogicalJoin(condition=[$4], joinType=[right])\n LogicalProject(DEPTNO=[$0], NAME=[$1], DEPTNO0=[$2], NAME0=[$3], $f4=[>($2, 10)])\n LogicalJoin(condition=[$4], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$1])\n LogicalJoin(condition=[true], joinType=[right])\n LogicalProject(DEPTNO=[$0], NAME=[$1], DEPTNO0=[$2], NAME0=[$3], $f4=[>($2, 10)])\n LogicalProject(DEPTNO=[$0], NAME=[$1], DEPTNO0=[CAST($2):INTEGER], NAME0=[CAST($3):VARCHAR(10)], $f2=[CAST($4):BOOLEAN])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[>($0, 10)])\n LogicalFilter(condition=[>($0, 10)])\n LogicalFilter(condition=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "RIGHT", "condition" : { "column" : 4, "type" : "BOOLEAN" }, "left" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : ">", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { "column" : 4, "type" : "BOOLEAN" @@ -56,8 +27,12 @@ "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -65,48 +40,21 @@ "column" : 1, "type" : "VARCHAR" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + "operator" : ">" + } ] } } } - } - } - }, - "right" : { - "scan" : 0 - } - } - } - } - }, { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -120,105 +68,83 @@ "column" : 3, "type" : "VARCHAR" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" - } ], + "operator" : ">" + } ] + } + }, + "kind" : "RIGHT", + "right" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] + } + }, { + "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, + "left" : { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "VARCHAR" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 4, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : ">", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 @@ -226,21 +152,95 @@ } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : ">" + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "CAST" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "BOOLEAN" + } ], + "operator" : "CAST" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : ">" + } ] } }, + "kind" : "RIGHT", "right" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(NAME=[$1])\n LogicalJoin(condition=[$4], joinType=[right])\n LogicalProject(DEPTNO=[$0], NAME=[$1], DEPTNO0=[$2], NAME0=[$3], $f4=[>($2, 10)])\n LogicalJoin(condition=[$4], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$1])\n LogicalJoin(condition=[true], joinType=[right])\n LogicalProject(DEPTNO=[$0], NAME=[$1], DEPTNO0=[$2], NAME0=[$3], $f4=[>($2, 10)])\n LogicalProject(DEPTNO=[$0], NAME=[$1], DEPTNO0=[CAST($2):INTEGER], NAME0=[CAST($3):VARCHAR(10)], $f2=[CAST($4):BOOLEAN])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[>($0, 10)])\n LogicalFilter(condition=[>($0, 10)])\n LogicalFilter(condition=[>($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushFilterSemijoin.json b/tests/calcite/testPushFilterSemijoin.json index f8df5c8..a838fc4 100644 --- a/tests/calcite/testPushFilterSemijoin.json +++ b/tests/calcite/testPushFilterSemijoin.json @@ -1,32 +1,28 @@ { + "help" : [ "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[AND(=($0, $10), =($8, 100))], joinType=[semi])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, EMP]])\n", "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $10)], joinType=[semi])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalFilter(condition=[=($5, 100)])\n LogicalTableScan(table=[[scott, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "DNAME", "LOC" ], "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ], [ 2 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true ], + "name" : "scott.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true, true, true, true, true, true ], + "name" : "scott.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "key" : [ [ 0 ], [ 1 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "TINYINT" @@ -34,41 +30,41 @@ "column" : 10, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 8, "type" : "DECIMAL" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "TINYINT" @@ -76,24 +72,25 @@ "column" : 10, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "DECIMAL" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 1 @@ -101,8 +98,11 @@ } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[AND(=($0, $10), =($8, 100))], joinType=[semi])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalTableScan(table=[[scott, EMP]])\n", "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $10)], joinType=[semi])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalFilter(condition=[=($5, 100)])\n LogicalTableScan(table=[[scott, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushFilterThroughSemiJoin.json b/tests/calcite/testPushFilterThroughSemiJoin.json index 4f0c585..81a18c5 100644 --- a/tests/calcite/testPushFilterThroughSemiJoin.json +++ b/tests/calcite/testPushFilterThroughSemiJoin.json @@ -1,47 +1,40 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[<=($0, 10)])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalFilter(condition=[<=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "<=" }, "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -49,41 +42,41 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -91,41 +84,48 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : "<=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "<=" }, "source" : { "scan" : 0 } } }, + "kind" : "SEMI", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[<=($0, 10)])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalFilter(condition=[<=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushFilterWithIsNotDistinctFromPastJoin.json b/tests/calcite/testPushFilterWithIsNotDistinctFromPastJoin.json index 67d9b10..855bd8b 100644 --- a/tests/calcite/testPushFilterWithIsNotDistinctFromPastJoin.json +++ b/tests/calcite/testPushFilterWithIsNotDistinctFromPastJoin.json @@ -1,95 +1,41 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalFilter(condition=[OR(AND(IS NULL($1), IS NULL($10)), IS TRUE(=($1, $10)))])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[AND(=($7, $16), IS NOT DISTINCT FROM($1, $10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "IS TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -97,17 +43,16 @@ "column" : 10, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "IS TRUE" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -115,21 +60,19 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 0 } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -184,14 +127,16 @@ }, { "column" : 17, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -199,9 +144,9 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "IS NOT DISTINCT FROM", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -209,19 +154,74 @@ "column" : 10, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT DISTINCT FROM" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalFilter(condition=[OR(AND(IS NULL($1), IS NULL($10)), IS TRUE(=($1, $10)))])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[AND(=($7, $16), IS NOT DISTINCT FROM($1, $10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushJoinCondDownToProject.json b/tests/calcite/testPushJoinCondDownToProject.json index 97bff64..abf6d01 100644 --- a/tests/calcite/testPushJoinCondDownToProject.json +++ b/tests/calcite/testPushJoinCondDownToProject.json @@ -1,126 +1,85 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], DEPTNO0=[$9])\n LogicalFilter(condition=[=(+($0, 10), *($9, 2))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], DEPTNO0=[$9])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$3], ENAME=[$4], JOB=[$5], MGR=[$6], HIREDATE=[$7], SAL=[$8], COMM=[$9], DEPTNO0=[$10], SLACKER=[$11])\n LogicalJoin(condition=[=($2, $12)], joinType=[inner])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[*($7, 2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "INTEGER" + "operator" : "+" }, { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { "column" : 9, "type" : "INTEGER" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "INTEGER" + "operator" : "*" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 9, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "TIMESTAMP" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "BOOLEAN" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -128,10 +87,13 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -139,24 +101,25 @@ "column" : 1, "type" : "VARCHAR" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "+" + } ] } }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -185,27 +148,64 @@ "column" : 8, "type" : "BOOLEAN" }, { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + "operator" : "*" + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "TIMESTAMP" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "BOOLEAN" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], DEPTNO0=[$9])\n LogicalFilter(condition=[=(+($0, 10), *($9, 2))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], DEPTNO0=[$9])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$3], ENAME=[$4], JOB=[$5], MGR=[$6], HIREDATE=[$7], SAL=[$8], COMM=[$9], DEPTNO0=[$10], SLACKER=[$11])\n LogicalJoin(condition=[=($2, $12)], joinType=[inner])\n LogicalProject(DEPTNO=[$0], NAME=[$1], $f2=[+($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[*($7, 2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushJoinThroughUnionOnLeft.json b/tests/calcite/testPushJoinThroughUnionOnLeft.json index 36b9134..92cd299 100644 --- a/tests/calcite/testPushJoinThroughUnionOnLeft.json +++ b/tests/calcite/testPushJoinThroughUnionOnLeft.json @@ -1,29 +1,28 @@ { + "help" : [ "LogicalProject(SAL=[$5])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalUnion(all=[true])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "union" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -51,13 +50,13 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -85,36 +84,36 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + } ] } } ] }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 5, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "union" : [ { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -142,26 +141,26 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + } ] } }, + "kind" : "INNER", "right" : { "scan" : 0 } } }, { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -189,19 +188,20 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + } ] } }, + "kind" : "INNER", "right" : { "scan" : 0 } } } ] - } + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(SAL=[$5])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalUnion(all=[true])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushJoinThroughUnionOnRight.json b/tests/calcite/testPushJoinThroughUnionOnRight.json index f586a0d..5a5263b 100644 --- a/tests/calcite/testPushJoinThroughUnionOnRight.json +++ b/tests/calcite/testPushJoinThroughUnionOnRight.json @@ -1,32 +1,32 @@ { + "help" : [ "LogicalProject(SAL=[$5])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalUnion(all=[true])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "union" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -54,13 +54,13 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -88,36 +88,36 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + } ] } } ] } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 5, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "union" : [ { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -145,26 +145,26 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + } ] } } } }, { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -192,16 +192,16 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + } ] } } } } ] - } + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(SAL=[$5])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalUnion(all=[true])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushMaxNullableGroupingSetsThroughUnion.json b/tests/calcite/testPushMaxNullableGroupingSetsThroughUnion.json index 78f2588..41663a3 100644 --- a/tests/calcite/testPushMaxNullableGroupingSetsThroughUnion.json +++ b/tests/calcite/testPushMaxNullableGroupingSetsThroughUnion.json @@ -1,660 +1,214 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MAX($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MAX($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" } ] } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } + } ] } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { + } ] + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" }, { - "column" : 1, + "column" : 2, "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + }, { + "column" : 3, + "type" : "INTEGER" + } ] + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" } ] } - } ] + } } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 4, + }, { + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 2, + "type" : "VARCHAR" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 3, + "type" : "INTEGER" } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MAX($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MAX($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MAX($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushMaxNullableThroughUnion.json b/tests/calcite/testPushMaxNullableThroughUnion.json index ff30efd..85bb915 100644 --- a/tests/calcite/testPushMaxNullableThroughUnion.json +++ b/tests/calcite/testPushMaxNullableThroughUnion.json @@ -1,552 +1,193 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" } ] } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } + } ] } - } - } + } ] + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 3, + "type" : "INTEGER" } ] } - } ] + } } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 3, + "type" : "INTEGER" } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[MAX($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushMinGroupingSetsThroughUnion.json b/tests/calcite/testPushMinGroupingSetsThroughUnion.json index c5aef1a..2600b2d 100644 --- a/tests/calcite/testPushMinGroupingSetsThroughUnion.json +++ b/tests/calcite/testPushMinGroupingSetsThroughUnion.json @@ -1,660 +1,214 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MIN($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MIN($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MIN($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MIN($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" } ] } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } + } ] } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { + } ] + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" }, { - "column" : 1, + "column" : 2, "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 0, + "type" : "INTEGER" } ] } - } ] + } } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 4, + }, { + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 2, + "type" : "VARCHAR" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 0, + "type" : "INTEGER" } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MIN($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[MIN($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MIN($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[MIN($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushMinThroughUnion.json b/tests/calcite/testPushMinThroughUnion.json index d64984c..25bba05 100644 --- a/tests/calcite/testPushMinThroughUnion.json +++ b/tests/calcite/testPushMinThroughUnion.json @@ -1,552 +1,193 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" } ] } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } + } ] } - } - } + } ] + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 0, + "type" : "INTEGER" } ] } - } ] + } } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 0, + "type" : "INTEGER" } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastFilter.json b/tests/calcite/testPushProjectPastFilter.json index c36860e..e6dc0a7 100644 --- a/tests/calcite/testPushProjectPastFilter.json +++ b/tests/calcite/testPushProjectPastFilter.json @@ -1,126 +1,119 @@ { + "help" : [ "LogicalProject(EXPR$0=[+($0, $7)])\n LogicalFilter(condition=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[+($0, $4)])\n LogicalFilter(condition=[AND(=($2, *(10, $3)), =(UPPER($1), 'FOO'))])\n LogicalProject(EMPNO=[$0], ENAME=[$1], SAL=[$5], COMM=[$6], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "+", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { "column" : 6, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "UPPER", + "type" : "VARCHAR", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "UPPER" }, { - "operator" : "_ISO-8859-1'FOO'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'FOO'" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "column" : 4, + "column" : 7, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], + "operator" : "+" + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "INTEGER" }, { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { "column" : 3, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "UPPER", + "type" : "VARCHAR", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "UPPER" }, { - "operator" : "_ISO-8859-1'FOO'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'FOO'" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -136,15 +129,22 @@ }, { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "+" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[+($0, $7)])\n LogicalFilter(condition=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[+($0, $4)])\n LogicalFilter(condition=[AND(=($2, *(10, $3)), =(UPPER($1), 'FOO'))])\n LogicalProject(EMPNO=[$0], ENAME=[$1], SAL=[$5], COMM=[$6], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastFilter2.json b/tests/calcite/testPushProjectPastFilter2.json index cced41a..15d38a3 100644 --- a/tests/calcite/testPushProjectPastFilter2.json +++ b/tests/calcite/testPushProjectPastFilter2.json @@ -1,218 +1,110 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[0])\n LogicalFilter(condition=[CASE(<($3, 10), true, false)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[0])\n LogicalFilter(condition=[<($0, 10)])\n LogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "false", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "0", - "operand" : [ ], + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "operator" : "false", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "operator" : "<" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + } ], + "operator" : "CASE" + }, + "source" : { + "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "<" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "0", - "operand" : [ ], + "column" : 3, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "<", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[0])\n LogicalFilter(condition=[CASE(<($3, 10), true, false)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[0])\n LogicalFilter(condition=[<($0, 10)])\n LogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastFilter3b.json b/tests/calcite/testPushProjectPastFilter3b.json index e5ee51f..800af80 100644 --- a/tests/calcite/testPushProjectPastFilter3b.json +++ b/tests/calcite/testPushProjectPastFilter3b.json @@ -1,119 +1,95 @@ { + "help" : [ "LogicalProject(X=[+($0, $7)], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(X=[$8], ENAME=[$0], JOB=[$1], MGR=[$2], HIREDATE=[$3], SAL=[$4], COMM=[$5], SLACKER=[$6])\n LogicalFilter(condition=[$7])\n LogicalProject(ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], $f7=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))], $f8=[+($0, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "+", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { "column" : 6, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "UPPER", + "type" : "VARCHAR", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "UPPER" }, { - "operator" : "_ISO-8859-1'FOO'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'FOO'" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "VARCHAR" + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "+" }, { "column" : 1, "type" : "VARCHAR" }, { "column" : 2, - "type" : "INTEGER" + "type" : "VARCHAR" }, { "column" : 3, - "type" : "TIMESTAMP" + "type" : "INTEGER" }, { "column" : 4, - "type" : "INTEGER" + "type" : "TIMESTAMP" }, { "column" : 5, "type" : "INTEGER" }, { "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { @@ -122,6 +98,9 @@ }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" @@ -144,44 +123,44 @@ "column" : 8, "type" : "BOOLEAN" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { "column" : 6, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "UPPER", + "type" : "VARCHAR", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "UPPER" }, { - "operator" : "_ISO-8859-1'FOO'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'FOO'" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -189,16 +168,37 @@ "column" : 7, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "+" + } ] } } } - } + }, + "target" : [ { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "TIMESTAMP" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(X=[+($0, $7)], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(X=[$8], ENAME=[$0], JOB=[$1], MGR=[$2], HIREDATE=[$3], SAL=[$4], COMM=[$5], SLACKER=[$6])\n LogicalFilter(condition=[$7])\n LogicalProject(ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], $f7=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))], $f8=[+($0, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastFilter3c.json b/tests/calcite/testPushProjectPastFilter3c.json index f2bc116..7274cc0 100644 --- a/tests/calcite/testPushProjectPastFilter3c.json +++ b/tests/calcite/testPushProjectPastFilter3c.json @@ -1,161 +1,140 @@ { + "help" : [ "LogicalProject(X=[+($0, $7)], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(X=[$7], ENAME=[$0], JOB=[$1], MGR=[$2], HIREDATE=[$3], SAL=[$4], COMM=[$5], SLACKER=[$6])\n LogicalFilter(condition=[AND(=($4, *(10, $5)), =(UPPER($0), 'FOO'))])\n LogicalProject(ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], $f7=[+($0, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "+", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { "column" : 6, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "UPPER", + "type" : "VARCHAR", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "UPPER" }, { - "operator" : "_ISO-8859-1'FOO'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'FOO'" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "VARCHAR" + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "+" }, { "column" : 1, "type" : "VARCHAR" }, { "column" : 2, - "type" : "INTEGER" + "type" : "VARCHAR" }, { "column" : 3, - "type" : "TIMESTAMP" + "type" : "INTEGER" }, { "column" : 4, - "type" : "INTEGER" + "type" : "TIMESTAMP" }, { "column" : 5, "type" : "INTEGER" }, { "column" : 6, + "type" : "INTEGER" + }, { + "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 4, "type" : "INTEGER" }, { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { "column" : 5, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "UPPER", + "type" : "VARCHAR", "operand" : [ { "column" : 0, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "UPPER" }, { - "operator" : "_ISO-8859-1'FOO'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'FOO'" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" @@ -178,7 +157,7 @@ "column" : 8, "type" : "BOOLEAN" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -186,16 +165,37 @@ "column" : 7, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "+" + } ] } } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "TIMESTAMP" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(X=[+($0, $7)], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($5, *(10, $6)), =(UPPER($1), 'FOO'))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(X=[$7], ENAME=[$0], JOB=[$1], MGR=[$2], HIREDATE=[$3], SAL=[$4], COMM=[$5], SLACKER=[$6])\n LogicalFilter(condition=[AND(=($4, *(10, $5)), =(UPPER($0), 'FOO'))])\n LogicalProject(ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], SLACKER=[$8], $f7=[+($0, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastFullJoin.json b/tests/calcite/testPushProjectPastFullJoin.json index daa9897..8e2397c 100644 --- a/tests/calcite/testPushProjectPastFullJoin.json +++ b/tests/calcite/testPushProjectPastFullJoin.json @@ -1,393 +1,205 @@ { + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalJoin(condition=[=($1, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE($1, 11, $2)])\n LogicalJoin(condition=[=($0, $3)], joinType=[full])\n LogicalProject(ENAME=[$1], EXPR$0=[<($5, 11)], EXPR$1=[*(-1, $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "BONUS", - "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false ], + "name" : "CATALOG.SALES.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, - "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } + "left" : { + "scan" : 0 + }, + "kind" : "FULL", + "right" : { + "scan" : 1 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + } ], + "operator" : "<" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "-1" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "*" + } ], + "operator" : "CASE" + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "BIGINT" }, { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "column" : 1, - "type" : "BOOLEAN" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, - "source" : { + "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "CASE", + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "BOOLEAN", "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" + "column" : 5, + "type" : "INTEGER" }, { - "operator" : "11", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "11" + } ], + "operator" : "<" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "-1" }, { - "column" : 3, + "column" : 5, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], + "operator" : "*" + } ] + } + }, + "kind" : "FULL", + "right" : { + "project" : { "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "<", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ] } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "CASE" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalJoin(condition=[=($1, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE($1, 11, $2)])\n LogicalJoin(condition=[=($0, $3)], joinType=[full])\n LogicalProject(ENAME=[$1], EXPR$0=[<($5, 11)], EXPR$1=[*(-1, $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastFullJoinStrong.json b/tests/calcite/testPushProjectPastFullJoinStrong.json index 1bc7981..e7bbc5f 100644 --- a/tests/calcite/testPushProjectPastFullJoinStrong.json +++ b/tests/calcite/testPushProjectPastFullJoinStrong.json @@ -1,383 +1,200 @@ { + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalJoin(condition=[=($1, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[full])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "BONUS", - "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false ], + "name" : "CATALOG.SALES.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "VARCHAR" }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" + "column" : 9, + "type" : "VARCHAR" } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "FULL", + "right" : { + "scan" : 1 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + } ], + "operator" : "<" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "-1" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "*" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "CASE" + } ] } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], + } + } + }, + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, - "source" : { + "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "CASE", + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", "operand" : [ { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { - "column" : 6, + "column" : 5, "type" : "INTEGER" }, { - "operator" : "11", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "11" } ], - "type" : "BOOLEAN" + "operator" : "<" }, { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { - "operator" : "-1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "-1" }, { - "column" : 6, + "column" : 5, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" }, { - "column" : 6, + "column" : 5, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], + "operator" : "CASE" + } ] + } + }, + "kind" : "FULL", + "right" : { + "project" : { "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ] } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "BIGINT" }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalJoin(condition=[=($1, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[full])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastInnerJoin.json b/tests/calcite/testPushProjectPastInnerJoin.json index cdad70b..13cd2e1 100644 --- a/tests/calcite/testPushProjectPastInnerJoin.json +++ b/tests/calcite/testPushProjectPastInnerJoin.json @@ -1,387 +1,202 @@ { + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalJoin(condition=[=($1, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "BONUS", - "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false ], + "name" : "CATALOG.SALES.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "VARCHAR" }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" + "column" : 9, + "type" : "VARCHAR" } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "scan" : 1 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + } ], + "operator" : "<" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "-1" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "*" + } ], + "operator" : "CASE" + } ] } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], + } + } + }, + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, - "source" : { + "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "CASE", + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", "operand" : [ { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { - "column" : 6, + "column" : 5, "type" : "INTEGER" }, { - "operator" : "11", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "11" } ], - "type" : "BOOLEAN" + "operator" : "<" }, { - "operator" : "11", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "11" }, { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { - "operator" : "-1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "-1" }, { - "column" : 6, + "column" : 5, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" } ], - "type" : "INTEGER" - } ], + "operator" : "CASE" + } ] + } + }, + "kind" : "INNER", + "right" : { + "project" : { "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ] } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "BIGINT" }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalJoin(condition=[=($1, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastInnerJoinStrong.json b/tests/calcite/testPushProjectPastInnerJoinStrong.json index 5cd74a7..7c3035c 100644 --- a/tests/calcite/testPushProjectPastInnerJoinStrong.json +++ b/tests/calcite/testPushProjectPastInnerJoinStrong.json @@ -1,383 +1,200 @@ { + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalJoin(condition=[=($1, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "BONUS", - "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false ], + "name" : "CATALOG.SALES.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "VARCHAR" }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" + "column" : 9, + "type" : "VARCHAR" } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "scan" : 1 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + } ], + "operator" : "<" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "-1" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "*" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "CASE" + } ] } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], + } + } + }, + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, - "source" : { + "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "CASE", + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", "operand" : [ { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { - "column" : 6, + "column" : 5, "type" : "INTEGER" }, { - "operator" : "11", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "11" } ], - "type" : "BOOLEAN" + "operator" : "<" }, { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { - "operator" : "-1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "-1" }, { - "column" : 6, + "column" : 5, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" }, { - "column" : 6, + "column" : 5, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], + "operator" : "CASE" + } ] + } + }, + "kind" : "INNER", + "right" : { + "project" : { "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ] } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "BIGINT" }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalJoin(condition=[=($1, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastJoin.json b/tests/calcite/testPushProjectPastJoin.json index 097e15b..4e9a12f 100644 --- a/tests/calcite/testPushProjectPastJoin.json +++ b/tests/calcite/testPushProjectPastJoin.json @@ -1,39 +1,28 @@ { + "help" : [ "LogicalProject(EXPR$0=[+($5, $12)])\n LogicalJoin(condition=[AND(=($1, $9), =($7, 10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[+($1, $4)])\n LogicalJoin(condition=[AND(=($0, $3), $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0], COMM=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "BONUS", - "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false ], + "name" : "CATALOG.SALES.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "+", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -41,50 +30,50 @@ "column" : 9, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { - "column" : 1, + "column" : 5, "type" : "INTEGER" }, { - "column" : 4, + "column" : 12, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], + "operator" : "+" + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "VARCHAR" @@ -92,15 +81,18 @@ "column" : 3, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { "column" : 2, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" @@ -108,39 +100,47 @@ "column" : 5, "type" : "INTEGER" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + "operator" : "=" + } ] } }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "VARCHAR" }, { "column" : 3, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "+" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[+($5, $12)])\n LogicalJoin(condition=[AND(=($1, $9), =($7, 10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[+($1, $4)])\n LogicalJoin(condition=[AND(=($0, $3), $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0], COMM=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastLeftJoin.json b/tests/calcite/testPushProjectPastLeftJoin.json index 73234b7..3b7bfe7 100644 --- a/tests/calcite/testPushProjectPastLeftJoin.json +++ b/tests/calcite/testPushProjectPastLeftJoin.json @@ -1,387 +1,202 @@ { + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalJoin(condition=[=($1, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "BONUS", - "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false ], + "name" : "CATALOG.SALES.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "VARCHAR" }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" + "column" : 9, + "type" : "VARCHAR" } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "scan" : 1 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + } ], + "operator" : "<" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "-1" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "*" + } ], + "operator" : "CASE" + } ] } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], + } + } + }, + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, - "source" : { + "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "CASE", + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", "operand" : [ { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { - "column" : 6, + "column" : 5, "type" : "INTEGER" }, { - "operator" : "11", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "11" } ], - "type" : "BOOLEAN" + "operator" : "<" }, { - "operator" : "11", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "11" }, { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { - "operator" : "-1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "-1" }, { - "column" : 6, + "column" : 5, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" } ], - "type" : "INTEGER" - } ], + "operator" : "CASE" + } ] + } + }, + "kind" : "LEFT", + "right" : { + "project" : { "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ] } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "BIGINT" }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalJoin(condition=[=($1, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastLeftJoinSwap.json b/tests/calcite/testPushProjectPastLeftJoinSwap.json index 8edfd6c..1dee042 100644 --- a/tests/calcite/testPushProjectPastLeftJoinSwap.json +++ b/tests/calcite/testPushProjectPastLeftJoinSwap.json @@ -1,393 +1,205 @@ { + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($9, 11), 11, *(-1, $9))])\n LogicalJoin(condition=[=($5, $0)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE($2, 11, $3)])\n LogicalJoin(condition=[=($1, $0)], joinType=[left])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$0=[<($5, 11)], EXPR$1=[*(-1, $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "BONUS", - "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false ], + "name" : "CATALOG.SALES.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, - "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "scan" : 1 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + } ], + "operator" : "<" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "-1" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "*" + } ], + "operator" : "CASE" + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "BIGINT" }, { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" + "column" : 1, + "type" : "VARCHAR" }, { - "column" : 3, - "type" : "INTEGER" + "column" : 0, + "type" : "VARCHAR" } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { + "scan" : 0 }, - "right" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { + "target" : [ { "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "type" : "VARCHAR" + } ] + } }, - "source" : { + "kind" : "LEFT", + "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { - "operator" : "CASE", + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "BOOLEAN", "operand" : [ { - "column" : 3, - "type" : "BOOLEAN" + "column" : 5, + "type" : "INTEGER" }, { - "operator" : "11", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "11" + } ], + "operator" : "<" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "-1" }, { - "column" : 4, + "column" : 5, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "<", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } + "operator" : "*" + } ] } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "BOOLEAN" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "CASE" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($9, 11), 11, *(-1, $9))])\n LogicalJoin(condition=[=($5, $0)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE($2, 11, $3)])\n LogicalJoin(condition=[=($1, $0)], joinType=[left])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$0=[<($5, 11)], EXPR$1=[*(-1, $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastLeftJoinSwapStrong.json b/tests/calcite/testPushProjectPastLeftJoinSwapStrong.json index 2ae418b..d17e4cf 100644 --- a/tests/calcite/testPushProjectPastLeftJoinSwapStrong.json +++ b/tests/calcite/testPushProjectPastLeftJoinSwapStrong.json @@ -1,383 +1,200 @@ { + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($9, 11), *(-1, $9), $9)])\n LogicalJoin(condition=[=($5, $0)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$2])\n LogicalJoin(condition=[=($1, $0)], joinType=[left])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "BONUS", - "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false ], + "name" : "CATALOG.SALES.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "scan" : 1 + } + } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + } ], + "operator" : "<" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "-1" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "*" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "CASE" + } ] + } + } + } + }, "target" : [ { "column" : 1, "type" : "BIGINT" }, { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "INTEGER" + "column" : 1, + "type" : "VARCHAR" }, { - "column" : 9, - "type" : "INTEGER" + "column" : 0, + "type" : "VARCHAR" } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { "scan" : 0 }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { + "target" : [ { "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "type" : "VARCHAR" + } ] + } }, - "source" : { + "kind" : "LEFT", + "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { - "operator" : "CASE", + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", "operand" : [ { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { - "column" : 10, + "column" : 5, "type" : "INTEGER" }, { - "operator" : "11", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "11" } ], - "type" : "BOOLEAN" + "operator" : "<" }, { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { - "operator" : "-1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "-1" }, { - "column" : 10, + "column" : 5, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" }, { - "column" : 10, + "column" : 5, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } + "operator" : "CASE" + } ] } } } - } + }, + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "BIGINT" }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($9, 11), *(-1, $9), $9)])\n LogicalJoin(condition=[=($5, $0)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$2])\n LogicalJoin(condition=[=($1, $0)], joinType=[left])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastOutJoinWithCastNonNullExpr.json b/tests/calcite/testPushProjectPastOutJoinWithCastNonNullExpr.json new file mode 100644 index 0000000..18e439a --- /dev/null +++ b/tests/calcite/testPushProjectPastOutJoinWithCastNonNullExpr.json @@ -0,0 +1,263 @@ +{ + "help" : [ "LogicalProject(C1=[+($0, 1)], C2=[CASE(IS NOT NULL($14), CAST($14):VARCHAR(10) NOT NULL, IS NOT NULL($10), CAST($10):VARCHAR(10) NOT NULL, '':VARCHAR(10))])\n LogicalJoin(condition=[=($7, $13)], joinType=[left])\n LogicalJoin(condition=[=($1, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(C1=[$2], C2=[CASE(IS NOT NULL($5), CAST($5):VARCHAR(10) NOT NULL, $3, CAST($1):VARCHAR(10) NOT NULL, '':VARCHAR(10))])\n LogicalJoin(condition=[=($0, $4)], joinType=[left])\n LogicalProject(DEPTNO=[$1], JOB0=[$4], C1=[$2], EXPR$1=[IS NOT NULL($4)])\n LogicalJoin(condition=[=($0, $3)], joinType=[left])\n LogicalProject(ENAME=[$1], DEPTNO=[$7], C1=[+($0, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0], JOB=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], + "schemas" : [ { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], + "nullable" : [ false, false, false, false ], + "name" : "CATALOG.SALES.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ ] + }, { + "types" : [ "INTEGER", "VARCHAR" ], + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + } ], + "queries" : [ { + "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "scan" : 1 + } + } + }, + "kind" : "LEFT", + "right" : { + "scan" : 2 + } + } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "+" + }, { + "type" : "VARCHAR", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 14, + "type" : "VARCHAR" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 14, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1''" + } ], + "operator" : "CASE" + } ] + } + }, { + "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "+" + } ] + } + }, + "kind" : "LEFT", + "right" : { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] + } + } + } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "operator" : "IS NOT NULL" + } ] + } + }, + "kind" : "LEFT", + "right" : { + "project" : { + "source" : { + "scan" : 2 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] + } + } + } + }, + "target" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "type" : "VARCHAR", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "VARCHAR" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 5, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + }, { + "column" : 3, + "type" : "BOOLEAN" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1''" + } ], + "operator" : "CASE" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastRightJoin.json b/tests/calcite/testPushProjectPastRightJoin.json index 94482eb..14776b1 100644 --- a/tests/calcite/testPushProjectPastRightJoin.json +++ b/tests/calcite/testPushProjectPastRightJoin.json @@ -1,393 +1,205 @@ { + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalJoin(condition=[=($1, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE($1, 11, $2)])\n LogicalJoin(condition=[=($0, $3)], joinType=[right])\n LogicalProject(ENAME=[$1], EXPR$0=[<($5, 11)], EXPR$1=[*(-1, $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "BONUS", - "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false ], + "name" : "CATALOG.SALES.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, - "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } - } + "left" : { + "scan" : 0 + }, + "kind" : "RIGHT", + "right" : { + "scan" : 1 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + } ], + "operator" : "<" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "-1" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "*" + } ], + "operator" : "CASE" + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "BIGINT" }, { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", - "operand" : [ { - "column" : 1, - "type" : "BOOLEAN" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, - "source" : { + "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "CASE", + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "BOOLEAN", "operand" : [ { - "column" : 2, - "type" : "BOOLEAN" + "column" : 5, + "type" : "INTEGER" }, { - "operator" : "11", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "11" + } ], + "operator" : "<" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "-1" }, { - "column" : 3, + "column" : 5, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], + "operator" : "*" + } ] + } + }, + "kind" : "RIGHT", + "right" : { + "project" : { "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "<", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ] } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "BOOLEAN" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "CASE" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalJoin(condition=[=($1, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE($1, 11, $2)])\n LogicalJoin(condition=[=($0, $3)], joinType=[right])\n LogicalProject(ENAME=[$1], EXPR$0=[<($5, 11)], EXPR$1=[*(-1, $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastRightJoinStrong.json b/tests/calcite/testPushProjectPastRightJoinStrong.json index e48051d..d64d539 100644 --- a/tests/calcite/testPushProjectPastRightJoinStrong.json +++ b/tests/calcite/testPushProjectPastRightJoinStrong.json @@ -1,383 +1,200 @@ { + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalJoin(condition=[=($1, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "BONUS", - "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false ], + "name" : "CATALOG.SALES.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "VARCHAR" }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" + "column" : 9, + "type" : "VARCHAR" } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "RIGHT", + "right" : { + "scan" : 1 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + } ], + "operator" : "<" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "-1" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "*" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "CASE" + } ] } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], + } + } + }, + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, - "source" : { + "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "CASE", + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", "operand" : [ { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { - "column" : 6, + "column" : 5, "type" : "INTEGER" }, { - "operator" : "11", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "11" } ], - "type" : "BOOLEAN" + "operator" : "<" }, { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { - "operator" : "-1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "-1" }, { - "column" : 6, + "column" : 5, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" }, { - "column" : 6, + "column" : 5, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], + "operator" : "CASE" + } ] + } + }, + "kind" : "RIGHT", + "right" : { + "project" : { "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ] } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "BIGINT" }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalJoin(condition=[=($1, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[right])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastRightJoinSwap.json b/tests/calcite/testPushProjectPastRightJoinSwap.json index 82a2209..87b51bf 100644 --- a/tests/calcite/testPushProjectPastRightJoinSwap.json +++ b/tests/calcite/testPushProjectPastRightJoinSwap.json @@ -1,387 +1,202 @@ { + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($9, 11), 11, *(-1, $9))])\n LogicalJoin(condition=[=($5, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$2])\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "BONUS", - "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false ], + "name" : "CATALOG.SALES.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "RIGHT", + "right" : { + "scan" : 1 + } + } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + } ], + "operator" : "<" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "-1" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "*" + } ], + "operator" : "CASE" + } ] + } + } + } + }, "target" : [ { "column" : 1, "type" : "BIGINT" }, { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" + "column" : 1, + "type" : "VARCHAR" }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "INTEGER" + "column" : 0, + "type" : "VARCHAR" } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { "scan" : 0 }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { + "target" : [ { "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "type" : "VARCHAR" + } ] + } }, - "source" : { + "kind" : "RIGHT", + "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { - "operator" : "CASE", + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", "operand" : [ { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { - "column" : 10, + "column" : 5, "type" : "INTEGER" }, { - "operator" : "11", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "11" } ], - "type" : "BOOLEAN" + "operator" : "<" }, { - "operator" : "11", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "11" }, { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { - "operator" : "-1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "-1" }, { - "column" : 10, + "column" : 5, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } + "operator" : "CASE" + } ] } } } - } + }, + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "BIGINT" }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($9, 11), 11, *(-1, $9))])\n LogicalJoin(condition=[=($5, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$2])\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), 11, *(-1, $5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastRightJoinSwapStrong.json b/tests/calcite/testPushProjectPastRightJoinSwapStrong.json index 5426444..50f8681 100644 --- a/tests/calcite/testPushProjectPastRightJoinSwapStrong.json +++ b/tests/calcite/testPushProjectPastRightJoinSwapStrong.json @@ -1,383 +1,200 @@ { + "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($9, 11), *(-1, $9), $9)])\n LogicalJoin(condition=[=($5, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$2])\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "BONUS", - "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false ], + "name" : "CATALOG.SALES.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "RIGHT", + "right" : { + "scan" : 1 + } + } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "11" + } ], + "operator" : "<" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "-1" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "*" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "CASE" + } ] + } + } + } + }, "target" : [ { "column" : 1, "type" : "BIGINT" }, { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "operator" : "CASE", + "join" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "INTEGER" + "column" : 1, + "type" : "VARCHAR" }, { - "column" : 9, - "type" : "INTEGER" + "column" : 0, + "type" : "VARCHAR" } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { "scan" : 0 }, - "right" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { + "target" : [ { "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "type" : "VARCHAR" + } ] + } }, - "source" : { + "kind" : "RIGHT", + "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { - "operator" : "CASE", + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", "operand" : [ { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { - "column" : 10, + "column" : 5, "type" : "INTEGER" }, { - "operator" : "11", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "11" } ], - "type" : "BOOLEAN" + "operator" : "<" }, { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { - "operator" : "-1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "-1" }, { - "column" : 10, + "column" : 5, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" }, { - "column" : 10, + "column" : 5, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } + "operator" : "CASE" + } ] } } } - } + }, + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "BIGINT" }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "11", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "*", - "operand" : [ { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[CASE(<($9, 11), *(-1, $9), $9)])\n LogicalJoin(condition=[=($5, $0)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$1], EXPR$1=[$0])\n LogicalAggregate(group=[{0}], EXPR$0=[COUNT()])\n LogicalProject(EXPR$1=[$2])\n LogicalJoin(condition=[=($1, $0)], joinType=[right])\n LogicalProject(ENAME=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalProject(ENAME=[$1], EXPR$1=[CASE(<($5, 11), *(-1, $5), $5)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectPastSetOp.json b/tests/calcite/testPushProjectPastSetOp.json index 41a07a1..38ad500 100644 --- a/tests/calcite/testPushProjectPastSetOp.json +++ b/tests/calcite/testPushProjectPastSetOp.json @@ -1,21 +1,21 @@ { + "help" : [ "LogicalProject(SAL=[$5])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalUnion(all=[true])\n LogicalProject(SAL=[$5])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(SAL=[$5])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], "source" : { "union" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -43,13 +43,13 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -77,23 +77,23 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + } ] } } ] - } + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ] } }, { "union" : [ { "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -121,21 +121,21 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + } ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 5, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -163,14 +163,14 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + } ] } - } + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ] } } ] - } ], - "help" : [ "LogicalProject(SAL=[$5])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalUnion(all=[true])\n LogicalProject(SAL=[$5])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(SAL=[$5])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectWithIsNotDistinctFromPastJoin.json b/tests/calcite/testPushProjectWithIsNotDistinctFromPastJoin.json index d265b38..6e533b7 100644 --- a/tests/calcite/testPushProjectWithIsNotDistinctFromPastJoin.json +++ b/tests/calcite/testPushProjectWithIsNotDistinctFromPastJoin.json @@ -1,39 +1,28 @@ { + "help" : [ "LogicalProject(EXPR$0=[+($5, $13)])\n LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($9, $14), =($7, 10))], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[||($1, $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0], JOB=[$1], SAL=[$2], COMM=[$3], $f4=[||($0, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[+($0, $3)])\n LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($1, $4), $2)], joinType=[inner])\n LogicalProject(SAL=[$5], $f9=[$9], EXPR$0=[=($7, 10)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[||($1, $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(COMM=[$3], $f4=[$4])\n LogicalProject(ENAME=[$0], JOB=[$1], SAL=[$2], COMM=[$3], $f4=[||($0, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "BONUS", - "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false ], + "name" : "CATALOG.SALES.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "+", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NOT DISTINCT FROM", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "VARCHAR" @@ -41,23 +30,26 @@ "column" : 14, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT DISTINCT FROM" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -86,7 +78,7 @@ "column" : 8, "type" : "BOOLEAN" }, { - "operator" : "||", + "type" : "VARCHAR", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -94,15 +86,16 @@ "column" : 2, "type" : "VARCHAR" } ], - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + "operator" : "||" + } ] } }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -116,7 +109,7 @@ "column" : 3, "type" : "INTEGER" }, { - "operator" : "||", + "type" : "VARCHAR", "operand" : [ { "column" : 0, "type" : "VARCHAR" @@ -124,36 +117,32 @@ "column" : 1, "type" : "VARCHAR" } ], - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } + "operator" : "||" + } ] } } } - } - } - }, { - "project" : { + }, "target" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { - "column" : 0, + "column" : 5, "type" : "INTEGER" }, { - "column" : 3, + "column" : 13, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], + "operator" : "+" + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NOT DISTINCT FROM", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -161,35 +150,20 @@ "column" : 4, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT DISTINCT FROM" }, { "column" : 2, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "VARCHAR" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -218,7 +192,7 @@ "column" : 8, "type" : "BOOLEAN" }, { - "operator" : "||", + "type" : "VARCHAR", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -226,26 +200,38 @@ "column" : 2, "type" : "VARCHAR" } ], - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + "operator" : "||" + } ] } - } - } - }, - "right" : { - "project" : { + }, "target" : [ { - "column" : 3, + "column" : 5, "type" : "INTEGER" }, { - "column" : 4, + "column" : 9, "type" : "VARCHAR" - } ], + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + } ] + } + }, + "kind" : "INNER", + "right" : { + "project" : { "source" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -259,7 +245,7 @@ "column" : 3, "type" : "INTEGER" }, { - "operator" : "||", + "type" : "VARCHAR", "operand" : [ { "column" : 0, "type" : "VARCHAR" @@ -267,18 +253,32 @@ "column" : 1, "type" : "VARCHAR" } ], - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } + "operator" : "||" + } ] } - } + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + } ] } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "+" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[+($5, $13)])\n LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($9, $14), =($7, 10))], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[||($1, $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0], JOB=[$1], SAL=[$2], COMM=[$3], $f4=[||($0, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[+($0, $3)])\n LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($1, $4), $2)], joinType=[inner])\n LogicalProject(SAL=[$5], $f9=[$9], EXPR$0=[=($7, 10)])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[||($1, $2)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(COMM=[$3], $f4=[$4])\n LogicalProject(ENAME=[$0], JOB=[$1], SAL=[$2], COMM=[$3], $f4=[||($0, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectWithOverPastJoin1.json b/tests/calcite/testPushProjectWithOverPastJoin1.json index 8e171d0..100ba6c 100644 --- a/tests/calcite/testPushProjectWithOverPastJoin1.json +++ b/tests/calcite/testPushProjectWithOverPastJoin1.json @@ -1,41 +1,28 @@ { + "help" : [ "LogicalProject(EXPR$0=[+($5, $12)], EXPR$1=[COUNT($0) OVER (PARTITION BY $7)])\n LogicalJoin(condition=[AND(=($1, $9), =($7, 10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[+($2, $6)], EXPR$1=[COUNT($0) OVER (PARTITION BY $3)])\n LogicalJoin(condition=[AND(=($1, $5), $4)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], SAL=[$5], DEPTNO=[$7], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0], COMM=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "BONUS", - "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false ], + "name" : "CATALOG.SALES.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "+", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "error" : "Not implemented: COUNT" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -43,52 +30,57 @@ "column" : 9, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { - "column" : 2, + "column" : 5, "type" : "INTEGER" }, { - "column" : 6, + "column" : 12, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "+" }, { - "error" : "Not implemented: COUNT" - } ], + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT" + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -96,15 +88,18 @@ "column" : 5, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { "column" : 4, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -118,39 +113,54 @@ "column" : 7, "type" : "INTEGER" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + "operator" : "=" + } ] } }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "VARCHAR" }, { "column" : 3, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "operator" : "+" + }, { + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[+($5, $12)], EXPR$1=[COUNT($0) OVER (PARTITION BY $7)])\n LogicalJoin(condition=[AND(=($1, $9), =($7, 10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[+($2, $6)], EXPR$1=[COUNT($0) OVER (PARTITION BY $3)])\n LogicalJoin(condition=[AND(=($1, $5), $4)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], SAL=[$5], DEPTNO=[$7], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0], COMM=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectWithOverPastJoin2.json b/tests/calcite/testPushProjectWithOverPastJoin2.json index c513508..fabc7ec 100644 --- a/tests/calcite/testPushProjectWithOverPastJoin2.json +++ b/tests/calcite/testPushProjectWithOverPastJoin2.json @@ -1,41 +1,28 @@ { + "help" : [ "LogicalProject(EXPR$0=[+($5, $12)], EXPR$1=[COUNT($11) OVER (PARTITION BY $10)])\n LogicalJoin(condition=[AND(=($1, $9), =($7, 10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[+($1, $6)], EXPR$1=[COUNT($5) OVER (PARTITION BY $4)])\n LogicalJoin(condition=[AND(=($0, $3), $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0], JOB=[$1], SAL=[$2], COMM=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "BONUS", - "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false ], + "name" : "CATALOG.SALES.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "+", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "error" : "Not implemented: COUNT" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -43,52 +30,57 @@ "column" : 9, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { - "column" : 1, + "column" : 5, "type" : "INTEGER" }, { - "column" : 6, + "column" : 12, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "+" }, { - "error" : "Not implemented: COUNT" - } ], + "type" : "BIGINT", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + } ], + "operator" : "COUNT" + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "VARCHAR" @@ -96,15 +88,18 @@ "column" : 3, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { "column" : 2, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" @@ -112,24 +107,25 @@ "column" : 5, "type" : "INTEGER" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + "operator" : "=" + } ] } }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -142,15 +138,29 @@ }, { "column" : 3, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + } ], + "operator" : "+" + }, { + "type" : "BIGINT", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "COUNT" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[+($5, $12)], EXPR$1=[COUNT($11) OVER (PARTITION BY $10)])\n LogicalJoin(condition=[AND(=($1, $9), =($7, 10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[+($1, $6)], EXPR$1=[COUNT($5) OVER (PARTITION BY $4)])\n LogicalJoin(condition=[AND(=($0, $3), $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0], JOB=[$1], SAL=[$2], COMM=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushProjectWithOverPastJoin3.json b/tests/calcite/testPushProjectWithOverPastJoin3.json index 75f1463..1f78163 100644 --- a/tests/calcite/testPushProjectWithOverPastJoin3.json +++ b/tests/calcite/testPushProjectWithOverPastJoin3.json @@ -1,41 +1,28 @@ { + "help" : [ "LogicalProject(EXPR$0=[+($5, $12)], EXPR$1=[SUM(+(+($11, $11), 100)) OVER (PARTITION BY $10)])\n LogicalJoin(condition=[AND(=($1, $9), =($7, 10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[+($1, $5)], EXPR$1=[SUM($6) OVER (PARTITION BY $4)])\n LogicalJoin(condition=[AND(=($0, $3), $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0], JOB=[$1], COMM=[$3], EXPR$0=[+(+($2, $2), 100)])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "BONUS", - "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false, false ], + "name" : "CATALOG.SALES.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "+", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "error" : "Not implemented: SUM" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -43,52 +30,72 @@ "column" : 9, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { - "column" : 1, + "column" : 5, "type" : "INTEGER" }, { - "column" : 5, + "column" : 12, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "+" }, { - "error" : "Not implemented: SUM" - } ], + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 11, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "operator" : "+" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "100" + } ], + "operator" : "+" + } ], + "operator" : "SUM" + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "VARCHAR" @@ -96,15 +103,18 @@ "column" : 3, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { "column" : 2, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" @@ -112,24 +122,25 @@ "column" : 5, "type" : "INTEGER" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + "operator" : "=" + } ] } }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -140,9 +151,9 @@ "column" : 3, "type" : "INTEGER" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -150,22 +161,36 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "+" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + "operator" : "+" + } ] } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "+" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "operator" : "SUM" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[+($5, $12)], EXPR$1=[SUM(+(+($11, $11), 100)) OVER (PARTITION BY $10)])\n LogicalJoin(condition=[AND(=($1, $9), =($7, 10))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(EXPR$0=[+($1, $5)], EXPR$1=[SUM($6) OVER (PARTITION BY $4)])\n LogicalJoin(condition=[AND(=($0, $3), $2)], joinType=[inner])\n LogicalProject(ENAME=[$1], SAL=[$5], EXPR$0=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ENAME=[$0], JOB=[$1], COMM=[$3], EXPR$0=[+(+($2, $2), 100)])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushSemiJoinConditions.json b/tests/calcite/testPushSemiJoinConditions.json index 4c3f8c4..f1044ff 100644 --- a/tests/calcite/testPushSemiJoinConditions.json +++ b/tests/calcite/testPushSemiJoinConditions.json @@ -1,34 +1,30 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[AND(OR(=($0, $2), AND(IS NULL($0), IS NULL($2))), OR(=($1, $3), AND(IS NULL($1), IS NULL($3))))], joinType=[semi])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($7, $8), IS NOT DISTINCT FROM($1, $9))], joinType=[semi])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true, true, true, true, true, true ], + "name" : "scott.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "key" : [ [ 0 ], [ 1 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "DNAME", "LOC" ], "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ], [ 2 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true ], + "name" : "scott.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "TINYINT" - } ], "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "TINYINT" @@ -36,31 +32,31 @@ "column" : 2, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" } ], - "type" : "BOOLEAN" + "operator" : "AND" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -68,83 +64,76 @@ "column" : 3, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" } ], - "type" : "BOOLEAN" + "operator" : "AND" } ], - "type" : "BOOLEAN" + "operator" : "OR" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 7, "type" : "TINYINT" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } }, + "kind" : "SEMI", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "TINYINT" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "TINYINT" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 7, - "type" : "TINYINT" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NOT DISTINCT FROM", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "TINYINT" @@ -152,9 +141,9 @@ "column" : 8, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT DISTINCT FROM" }, { - "operator" : "IS NOT DISTINCT FROM", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -162,32 +151,43 @@ "column" : 9, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT DISTINCT FROM" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "TINYINT" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "target" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "TINYINT" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[AND(OR(=($0, $2), AND(IS NULL($0), IS NULL($2))), OR(=($1, $3), AND(IS NULL($1), IS NULL($3))))], joinType=[semi])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalProject(DEPTNO=[$7], ENAME=[$1])\n LogicalJoin(condition=[AND(IS NOT DISTINCT FROM($7, $8), IS NOT DISTINCT FROM($1, $9))], joinType=[semi])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushSemiJoinPastFilter.json b/tests/calcite/testPushSemiJoinPastFilter.json index 199d72c..0fe6d71 100644 --- a/tests/calcite/testPushSemiJoinPastFilter.json +++ b/tests/calcite/testPushSemiJoinPastFilter.json @@ -1,31 +1,28 @@ { + "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($1, 'foo'))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalFilter(condition=[=($1, 'foo')])\n LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -33,51 +30,50 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'foo'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'foo'" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -85,27 +81,26 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'foo'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'foo'" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -113,11 +108,12 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { "scan" : 1 } @@ -125,12 +121,16 @@ } } }, + "kind" : "INNER", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($1, 'foo'))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalFilter(condition=[=($1, 'foo')])\n LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushSemiJoinPastJoinRuleLeft.json b/tests/calcite/testPushSemiJoinPastJoinRuleLeft.json index 69dceea..5544830 100644 --- a/tests/calcite/testPushSemiJoinPastJoinRuleLeft.json +++ b/tests/calcite/testPushSemiJoinPastJoinRuleLeft.json @@ -1,31 +1,28 @@ { + "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($0, $11))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($0, $11)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($0, $9)], joinType=[semi])\n LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -33,9 +30,9 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -43,53 +40,52 @@ "column" : 11, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } }, + "kind" : "INNER", "right" : { "scan" : 0 } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -97,13 +93,12 @@ "column" : 11, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -111,13 +106,12 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -125,13 +119,12 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -139,32 +132,39 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { "scan" : 1 } } }, + "kind" : "SEMI", "right" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "scan" : 1 } } }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($0, $11))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($0, $11)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($0, $9)], joinType=[semi])\n LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushSemiJoinPastJoinRuleNotHappensJoinKeysDifferentOrigin.json b/tests/calcite/testPushSemiJoinPastJoinRuleNotHappensJoinKeysDifferentOrigin.json new file mode 100644 index 0000000..3e69635 --- /dev/null +++ b/tests/calcite/testPushSemiJoinPastJoinRuleNotHappensJoinKeysDifferentOrigin.json @@ -0,0 +1,215 @@ +{ + "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($1, $11), =($10, $12))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[AND(=($1, $11), =($10, $12))], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[AND(=($1, $11), =($10, $12))], joinType=[semi])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n LogicalTableScan(table=[[CATALOG, SALES, BONUS]])\n" ], + "schemas" : [ { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR" ], + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "VARCHAR", "VARCHAR", "INTEGER", "INTEGER" ], + "nullable" : [ false, false, false, false ], + "name" : "CATALOG.SALES.BONUS", + "guaranteed" : [ ], + "fields" : [ "ENAME", "JOB", "SAL", "COMM" ], + "key" : [ ] + } ], + "queries" : [ { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "operator" : "=" + } ], + "operator" : "AND" + }, + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, + "left" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "scan" : 1 + } + } + }, + "kind" : "INNER", + "right" : { + "scan" : 2 + } + } + } + } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] + } + }, { + "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "operator" : "=" + } ], + "operator" : "AND" + }, + "left" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "VARCHAR" + } ], + "operator" : "=" + } ], + "operator" : "AND" + }, + "left" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "SEMI", + "right" : { + "scan" : 1 + } + } + }, + "kind" : "INNER", + "right" : { + "scan" : 1 + } + } + }, + "kind" : "SEMI", + "right" : { + "scan" : 2 + } + } + }, + "kind" : "INNER", + "right" : { + "scan" : 2 + } + } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testPushSemiJoinPastJoinRuleRight.json b/tests/calcite/testPushSemiJoinPastJoinRuleRight.json index 287573c..56b31ed 100644 --- a/tests/calcite/testPushSemiJoinPastJoinRuleRight.json +++ b/tests/calcite/testPushSemiJoinPastJoinRuleRight.json @@ -1,31 +1,28 @@ { + "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($9, $18))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($9, $18)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalJoin(condition=[=($0, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -33,9 +30,9 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" @@ -43,53 +40,52 @@ "column" : 18, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } }, + "kind" : "INNER", "right" : { "scan" : 0 } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" @@ -97,13 +93,12 @@ "column" : 18, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -111,13 +106,12 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -125,21 +119,22 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { "scan" : 1 } } }, + "kind" : "INNER", "right" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -147,11 +142,12 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 1 }, + "kind" : "SEMI", "right" : { "scan" : 0 } @@ -159,12 +155,16 @@ } } }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($9, $18))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($9, $18)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalJoin(condition=[=($0, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushSemiJoinPastProject.json b/tests/calcite/testPushSemiJoinPastProject.json index 2f3494a..552598c 100644 --- a/tests/calcite/testPushSemiJoinPastProject.json +++ b/tests/calcite/testPushSemiJoinPastProject.json @@ -1,38 +1,26 @@ { + "help" : [ "LogicalProject(ENAME=[$0], EXPR$1=[$1], EXPR$2=[$2], DEPTNO=[$3])\n LogicalFilter(condition=[=($3, $4)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(ENAME=[$1], EXPR$1=[TRIM(FLAG(BOTH), ' ', $2)], EXPR$2=[*($5, 2)], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(ENAME=[$0], EXPR$1=[$1], EXPR$2=[$2], DEPTNO=[$3])\n LogicalJoin(condition=[=($3, $4)], joinType=[inner], semiJoinDone=[true])\n LogicalProject(ENAME=[$1], EXPR$1=[TRIM(FLAG(BOTH), ' ', $2)], EXPR$2=[*($5, 2)], DEPTNO=[$7])\n LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" @@ -40,66 +28,63 @@ "column" : 4, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "TRIM", + "type" : "VARCHAR", "operand" : [ { - "operator" : "BOTH", + "type" : "SYMBOL", "operand" : [ ], - "type" : "SYMBOL" + "operator" : "BOTH" }, { - "operator" : "_ISO-8859-1' '", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "_ISO-8859-1' '" }, { "column" : 2, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "TRIM" }, { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "INTEGER" + "operator" : "*" }, { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } }, + "kind" : "INNER", "right" : { "scan" : 1 } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -112,12 +97,14 @@ }, { "column" : 3, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" @@ -125,73 +112,86 @@ "column" : 4, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "SEMI", + "right" : { + "scan" : 1 + } + } + }, "target" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "TRIM", + "type" : "VARCHAR", "operand" : [ { - "operator" : "BOTH", + "type" : "SYMBOL", "operand" : [ ], - "type" : "SYMBOL" + "operator" : "BOTH" }, { - "operator" : "_ISO-8859-1' '", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "_ISO-8859-1' '" }, { "column" : 2, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "TRIM" }, { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "INTEGER" + "operator" : "*" }, { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "join" : { - "kind" : "SEMI", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - } + } ] } }, + "kind" : "INNER", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(ENAME=[$0], EXPR$1=[$1], EXPR$2=[$2], DEPTNO=[$3])\n LogicalFilter(condition=[=($3, $4)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(ENAME=[$1], EXPR$1=[TRIM(FLAG(BOTH), ' ', $2)], EXPR$2=[*($5, 2)], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(ENAME=[$0], EXPR$1=[$1], EXPR$2=[$2], DEPTNO=[$3])\n LogicalJoin(condition=[=($3, $4)], joinType=[inner], semiJoinDone=[true])\n LogicalProject(ENAME=[$1], EXPR$1=[TRIM(FLAG(BOTH), ' ', $2)], EXPR$2=[*($5, 2)], DEPTNO=[$7])\n LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushSumConstantGroupingSetsThroughUnion.json b/tests/calcite/testPushSumConstantGroupingSetsThroughUnion.json index 19a4a49..3925b23 100644 --- a/tests/calcite/testPushSumConstantGroupingSetsThroughUnion.json +++ b/tests/calcite/testPushSumConstantGroupingSetsThroughUnion.json @@ -1,684 +1,224 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[$9])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" } ] } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "3" + } ] } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { + } ] + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" }, { - "column" : 1, + "column" : 2, "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + }, { + "column" : 9, + "type" : "INTEGER" + } ] + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" } ] } - } ] + } } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, + }, { + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 2, + "type" : "VARCHAR" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "type" : "INTEGER", + "operand" : [ ], + "operator" : "3" } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[$9])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushSumConstantThroughUnion.json b/tests/calcite/testPushSumConstantThroughUnion.json index d632121..c8ac48c 100644 --- a/tests/calcite/testPushSumConstantThroughUnion.json +++ b/tests/calcite/testPushSumConstantThroughUnion.json @@ -1,576 +1,203 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[$9])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" } ] } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "3" + } ] } - } - } + } ] + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" } ] } - } ] + } } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "type" : "INTEGER", + "operand" : [ ], + "operator" : "3" } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[$9])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushSumCountStarGroupingSetsThroughUnion.json b/tests/calcite/testPushSumCountStarGroupingSetsThroughUnion.json index a45b798..e35e053 100644 --- a/tests/calcite/testPushSumCountStarGroupingSetsThroughUnion.json +++ b/tests/calcite/testPushSumCountStarGroupingSetsThroughUnion.json @@ -1,807 +1,313 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)], EXPR$3=[COUNT()], EXPR$4=[MIN($0)], EXPR$5=[MAX($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)], EXPR$3=[$SUM0($3)], EXPR$4=[MIN($4)], EXPR$5=[MAX($5)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)], EXPR$3=[COUNT()], EXPR$4=[MIN($0)], EXPR$5=[MAX($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)], EXPR$3=[COUNT()], EXPR$4=[MIN($0)], EXPR$5=[MAX($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" } ] } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" } ] } } ] - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "$SUM0", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 6, + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 2, + "type" : "VARCHAR" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 0, + "type" : "INTEGER" } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)], EXPR$3=[COUNT()], EXPR$4=[MIN($0)], EXPR$5=[MAX($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)], EXPR$3=[$SUM0($3)], EXPR$4=[MIN($4)], EXPR$5=[MAX($5)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)], EXPR$3=[COUNT()], EXPR$4=[MIN($0)], EXPR$5=[MAX($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)], EXPR$3=[COUNT()], EXPR$4=[MIN($0)], EXPR$5=[MAX($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], EMPNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushSumCountStarThroughUnion.json b/tests/calcite/testPushSumCountStarThroughUnion.json index 21e89a1..ce0a3dc 100644 --- a/tests/calcite/testPushSumCountStarThroughUnion.json +++ b/tests/calcite/testPushSumCountStarThroughUnion.json @@ -1,729 +1,301 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT()], EXPR$3=[MIN($2)], EXPR$4=[MAX($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], DEPTNO=[$7])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[$SUM0($2)], EXPR$3=[MIN($3)], EXPR$4=[MAX($4)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT()], EXPR$3=[MIN($2)], EXPR$4=[MAX($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT()], EXPR$3=[MIN($2)], EXPR$4=[MAX($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" } ] } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] + } + } ] + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" }, { - "operator" : "MIN", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "column" : 0, "type" : "INTEGER" }, { - "operator" : "MAX", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } - } - } - } + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" } ] } - } ] + } } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "$SUM0", - "operand" : [ { - "column" : 3, - "type" : "BIGINT" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT()], EXPR$3=[MIN($2)], EXPR$4=[MAX($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], DEPTNO=[$7])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[$SUM0($2)], EXPR$3=[MIN($3)], EXPR$4=[MAX($4)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT()], EXPR$3=[MIN($2)], EXPR$4=[MAX($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[COUNT()], EXPR$3=[MIN($2)], EXPR$4=[MAX($1)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushSumNullConstantGroupingSetsThroughUnion.json b/tests/calcite/testPushSumNullConstantGroupingSetsThroughUnion.json index 78cbb1d..dbbc885 100644 --- a/tests/calcite/testPushSumNullConstantGroupingSetsThroughUnion.json +++ b/tests/calcite/testPushSumNullConstantGroupingSetsThroughUnion.json @@ -1,684 +1,224 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[$9])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" } ] } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + } ] } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { + } ] + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" }, { - "column" : 1, + "column" : 2, "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + }, { + "column" : 9, + "type" : "INTEGER" + } ] + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" } ] } - } ] + } } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, + }, { + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 2, + "type" : "VARCHAR" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[$9])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushSumNullConstantThroughUnion.json b/tests/calcite/testPushSumNullConstantThroughUnion.json index 9378271..5a23090 100644 --- a/tests/calcite/testPushSumNullConstantThroughUnion.json +++ b/tests/calcite/testPushSumNullConstantThroughUnion.json @@ -1,576 +1,203 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[$9])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" } ] } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + } ] } - } - } + } ] + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "INTEGER" + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" } ] } - } ] + } } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[$9])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], U=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushSumNullableGroupingSetsThroughUnion.json b/tests/calcite/testPushSumNullableGroupingSetsThroughUnion.json index a97ecb1..d7fd9fa 100644 --- a/tests/calcite/testPushSumNullableGroupingSetsThroughUnion.json +++ b/tests/calcite/testPushSumNullableGroupingSetsThroughUnion.json @@ -1,660 +1,214 @@ { + "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" } ] } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } + } ] } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { + } ] + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" }, { - "column" : 1, + "column" : 2, "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + }, { + "column" : 3, + "type" : "INTEGER" + } ] + } + } + } + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" } ] } - } ] + } } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, + }, { + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 2, + "type" : "VARCHAR" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 3, + "type" : "INTEGER" } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], EXPR$2=[SUM($2)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[SUM($2)])\n LogicalProject(DEPTNO=[$7], JOB=[$2], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushSumNullableNOGBYThroughUnion.json b/tests/calcite/testPushSumNullableNOGBYThroughUnion.json index 4bec949..04a00ff 100644 --- a/tests/calcite/testPushSumNullableNOGBYThroughUnion.json +++ b/tests/calcite/testPushSumNullableNOGBYThroughUnion.json @@ -1,444 +1,172 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject(MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], "source" : { "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" } ] } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" } ] } } ] - } + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ] } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" + } + } + }, { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" } ] } } } - } - } ] + }, { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ] + } + } + } + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject(MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])\n LogicalProject(MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testPushSumNullableThroughUnion.json b/tests/calcite/testPushSumNullableThroughUnion.json index cfd91ac..128cbc3 100644 --- a/tests/calcite/testPushSumNullableThroughUnion.json +++ b/tests/calcite/testPushSumNullableThroughUnion.json @@ -1,552 +1,193 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" } ] } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "TIMESTAMP" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } + } ] } - } - } + } ] + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "union" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 3, + "type" : "INTEGER" } ] } - } ] + } } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" + }, { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } + "column" : 3, + "type" : "INTEGER" } ] } } } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalUnion(all=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])\n LogicalProject(ENAME=[$1], MGR=[$3])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceAggregateFunctionsByGroup.json b/tests/calcite/testReduceAggregateFunctionsByGroup.json index a836cba..234c1f7 100644 --- a/tests/calcite/testReduceAggregateFunctionsByGroup.json +++ b/tests/calcite/testReduceAggregateFunctionsByGroup.json @@ -1,14 +1,95 @@ { + "help" : [ "LogicalProject(SAL=[$0], SAL_MAX=[$2], SAL_MIN=[$3], SAL_AVG=[$4], SAL_VAL=[$5], SAL_FIRST=[$6], SAL_LAST=[$7])\n LogicalAggregate(group=[{0, 1}], SAL_MAX=[MAX($0)], SAL_MIN=[MIN($0)], SAL_AVG=[AVG($0)], SAL_VAL=[ANY_VALUE($0)], SAL_FIRST=[FIRST_VALUE($0)], SAL_LAST=[LAST_VALUE($0)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$0], SAL_MAX=[$0], SAL_MIN=[$0], SAL_AVG=[$0], SAL_VAL=[$0], SAL_FIRST=[$0], SAL_LAST=[$0])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "ANY_VALUE", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "FIRST_VALUE", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "LAST_VALUE", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ] + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -30,140 +111,36 @@ }, { "column" : 7, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "AVG", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "ANY_VALUE", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "FIRST_VALUE", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "column" : 5, "type" : "INTEGER" }, { - "operator" : "LAST_VALUE", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -185,84 +162,7 @@ }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalProject(SAL=[$0], SAL_MAX=[$2], SAL_MIN=[$3], SAL_AVG=[$4], SAL_VAL=[$5], SAL_FIRST=[$6], SAL_LAST=[$7])\n LogicalAggregate(group=[{0, 1}], SAL_MAX=[MAX($0)], SAL_MIN=[MIN($0)], SAL_AVG=[AVG($0)], SAL_VAL=[ANY_VALUE($0)], SAL_FIRST=[FIRST_VALUE($0)], SAL_LAST=[LAST_VALUE($0)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$0], SAL_MAX=[$0], SAL_MIN=[$0], SAL_AVG=[$0], SAL_VAL=[$0], SAL_FIRST=[$0], SAL_LAST=[$0])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceAllAggregateFunctions.json b/tests/calcite/testReduceAllAggregateFunctions.json index 2b77b87..31a4a0d 100644 --- a/tests/calcite/testReduceAllAggregateFunctions.json +++ b/tests/calcite/testReduceAllAggregateFunctions.json @@ -1,139 +1,168 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[STDDEV_SAMP($1)], EXPR$4=[VAR_POP($1)], EXPR$5=[VAR_SAMP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[CAST(POWER(/(-($1, /(*($2, $2), $3)), $3), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[CAST(POWER(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1))), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$4=[CAST(/(-($1, /(*($2, $2), $3)), $3)):INTEGER NOT NULL], EXPR$5=[CAST(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1)))):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($2)], agg#1=[$SUM0($1)], agg#2=[COUNT()])\n LogicalProject(NAME=[$0], DEPTNO=[$1], $f2=[*($1, $1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "STDDEV_POP", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "STDDEV_SAMP", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "VAR_POP", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "VAR_SAMP", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "VARCHAR" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "STDDEV_POP", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "AVG", + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "$SUM0", + "ignoreNulls" : false }, { - "operator" : "STDDEV_SAMP", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "VAR_POP", + "type" : "INTEGER", "operand" : [ { - "column" : 2, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "$SUM0", + "ignoreNulls" : false }, { - "operator" : "VAR_SAMP", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 2, + "column" : 1, "type" : "VARCHAR" }, { - "column" : 1, + "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "*" + } ] } } } - } ] - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "POWER", + "type" : "DOUBLE", "operand" : [ { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { - "operator" : "-", + "type" : "BIGINT", "operand" : [ { "column" : 1, "type" : "INTEGER" }, { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -141,31 +170,31 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" }, { "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "BIGINT" + "operator" : "-" }, { "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" }, { - "operator" : "0.5", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "0.5" } ], - "type" : "DOUBLE" + "operator" : "POWER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -173,24 +202,24 @@ "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "POWER", + "type" : "DOUBLE", "operand" : [ { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { - "operator" : "-", + "type" : "BIGINT", "operand" : [ { "column" : 1, "type" : "INTEGER" }, { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -198,67 +227,67 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" }, { "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "BIGINT" + "operator" : "-" }, { - "operator" : "CASE", + "type" : "BIGINT", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "BIGINT" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "NULL", + "type" : "BIGINT", "operand" : [ ], - "type" : "BIGINT" + "operator" : "NULL" }, { - "operator" : "-", + "type" : "BIGINT", "operand" : [ { "column" : 3, "type" : "BIGINT" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BIGINT" + "operator" : "-" } ], - "type" : "BIGINT" + "operator" : "CASE" } ], - "type" : "BIGINT" + "operator" : "/" }, { - "operator" : "0.5", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "0.5" } ], - "type" : "DOUBLE" + "operator" : "POWER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { - "operator" : "-", + "type" : "BIGINT", "operand" : [ { "column" : 1, "type" : "INTEGER" }, { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -266,34 +295,34 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" }, { "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "BIGINT" + "operator" : "-" }, { "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { - "operator" : "-", + "type" : "BIGINT", "operand" : [ { "column" : 1, "type" : "INTEGER" }, { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -301,179 +330,49 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" }, { "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "BIGINT" + "operator" : "-" }, { - "operator" : "CASE", + "type" : "BIGINT", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "BIGINT" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "NULL", + "type" : "BIGINT", "operand" : [ ], - "type" : "BIGINT" + "operator" : "NULL" }, { - "operator" : "-", + "type" : "BIGINT", "operand" : [ { "column" : 3, "type" : "BIGINT" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BIGINT" + "operator" : "-" } ], - "type" : "BIGINT" + "operator" : "CASE" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "$SUM0", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - } + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[STDDEV_SAMP($1)], EXPR$4=[VAR_POP($1)], EXPR$5=[VAR_SAMP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[CAST(POWER(/(-($1, /(*($2, $2), $3)), $3), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[CAST(POWER(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1))), 0.5:DECIMAL(2, 1))):INTEGER NOT NULL], EXPR$4=[CAST(/(-($1, /(*($2, $2), $3)), $3)):INTEGER NOT NULL], EXPR$5=[CAST(/(-($1, /(*($2, $2), $3)), CASE(=($3, 1), null:BIGINT, -($3, 1)))):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($2)], agg#1=[$SUM0($1)], agg#2=[COUNT()])\n LogicalProject(NAME=[$0], DEPTNO=[$1], $f2=[*($1, $1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceAverage.json b/tests/calcite/testReduceAverage.json index a5dd797..66511d5 100644 --- a/tests/calcite/testReduceAverage.json +++ b/tests/calcite/testReduceAverage.json @@ -1,103 +1,102 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[MAX($0)], EXPR$2=[AVG($1)], EXPR$3=[MIN($0)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[$0], EXPR$2=[CAST(/($1, $2)):INTEGER NOT NULL], EXPR$3=[$0])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1)], agg#1=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "VARCHAR", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "VARCHAR", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "VARCHAR" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "VARCHAR" - }, { - "operator" : "AVG", + "type" : "INTEGER", "operand" : [ { - "column" : 2, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "$SUM0", + "ignoreNulls" : false }, { - "operator" : "MIN", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "VARCHAR" + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] } } } - } ] - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -105,9 +104,9 @@ "column" : 0, "type" : "VARCHAR" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { "column" : 1, "type" : "INTEGER" @@ -115,92 +114,13 @@ "column" : 2, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { "column" : 0, "type" : "VARCHAR" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[MAX($0)], EXPR$2=[AVG($1)], EXPR$3=[MIN($0)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[$0], EXPR$2=[CAST(/($1, $2)):INTEGER NOT NULL], EXPR$3=[$0])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1)], agg#1=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceAverageAndSumWithNoReduceStddevAndVar.json b/tests/calcite/testReduceAverageAndSumWithNoReduceStddevAndVar.json index bfe3af3..6711e52 100644 --- a/tests/calcite/testReduceAverageAndSumWithNoReduceStddevAndVar.json +++ b/tests/calcite/testReduceAverageAndSumWithNoReduceStddevAndVar.json @@ -1,103 +1,120 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[VAR_POP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[$4])\n LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], agg#1=[$SUM0($1)], agg#2=[COUNT()], EXPR$3=[VAR_POP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "STDDEV_POP", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "VAR_POP", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "VARCHAR" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "STDDEV_POP", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 2, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "STDDEV_POP", + "ignoreNulls" : false }, { - "operator" : "AVG", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 2, + "column" : 1, "type" : "INTEGER" } ], + "operator" : "$SUM0", + "ignoreNulls" : false + }, { "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false }, { - "operator" : "VAR_POP", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 2, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "VAR_POP", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] } } } - } ] - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -105,9 +122,9 @@ "column" : 1, "type" : "INTEGER" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -115,110 +132,13 @@ "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { "column" : 4, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "STDDEV_POP", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "$SUM0", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "VAR_POP", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[VAR_POP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[$4])\n LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], agg#1=[$SUM0($1)], agg#2=[COUNT()], EXPR$3=[VAR_POP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceAverageAndVarWithNoReduceStddev.json b/tests/calcite/testReduceAverageAndVarWithNoReduceStddev.json index 5ccd581..905e8ac 100644 --- a/tests/calcite/testReduceAverageAndVarWithNoReduceStddev.json +++ b/tests/calcite/testReduceAverageAndVarWithNoReduceStddev.json @@ -1,103 +1,141 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[VAR_POP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[CAST(/(-($4, /(*($2, $2), $3)), $3)):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], agg#1=[SUM($1)], agg#2=[COUNT()], agg#3=[SUM($2)])\n LogicalProject(NAME=[$0], DEPTNO=[$1], $f2=[*($1, $1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "STDDEV_POP", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "VAR_POP", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "VARCHAR" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "STDDEV_POP", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 2, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "STDDEV_POP", + "ignoreNulls" : false }, { - "operator" : "AVG", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 2, + "column" : 1, "type" : "INTEGER" } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false }, { - "operator" : "VAR_POP", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "SUM", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 2, + "column" : 1, "type" : "VARCHAR" }, { - "column" : 1, + "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "*" + } ] } } } - } ] - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -105,9 +143,9 @@ "column" : 1, "type" : "INTEGER" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -115,22 +153,22 @@ "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { - "operator" : "-", + "type" : "BIGINT", "operand" : [ { "column" : 4, "type" : "INTEGER" }, { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { - "operator" : "*", + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -138,161 +176,22 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "*" }, { "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "BIGINT" + "operator" : "-" }, { "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "STDDEV_POP", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "*", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - } + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], EXPR$2=[AVG($1)], EXPR$3=[VAR_POP($1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL], EXPR$3=[CAST(/(-($4, /(*($2, $2), $3)), $3)):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], EXPR$1=[STDDEV_POP($1)], agg#1=[SUM($1)], agg#2=[COUNT()], agg#3=[SUM($2)])\n LogicalProject(NAME=[$0], DEPTNO=[$1], $f2=[*($1, $1)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceAverageWithNoReduceSum.json b/tests/calcite/testReduceAverageWithNoReduceSum.json index deac8b2..17d7780 100644 --- a/tests/calcite/testReduceAverageWithNoReduceSum.json +++ b/tests/calcite/testReduceAverageWithNoReduceSum.json @@ -1,103 +1,102 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[MAX($0)], EXPR$2=[AVG($1)], EXPR$3=[MIN($0)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[$0], EXPR$2=[CAST(/($1, $2)):INTEGER NOT NULL], EXPR$3=[$0])\n LogicalAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "VARCHAR", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "VARCHAR", + "operand" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "VARCHAR" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "MAX", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "VARCHAR" - }, { - "operator" : "AVG", + "type" : "INTEGER", "operand" : [ { - "column" : 2, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "SUM", + "ignoreNulls" : false }, { - "operator" : "MIN", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "distinct" : false, - "ignoreNulls" : false, - "type" : "VARCHAR" + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] } } } - } ] - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -105,9 +104,9 @@ "column" : 0, "type" : "VARCHAR" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { "column" : 1, "type" : "INTEGER" @@ -115,92 +114,13 @@ "column" : 2, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { "column" : 0, "type" : "VARCHAR" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[MAX($0)], EXPR$2=[AVG($1)], EXPR$3=[MIN($0)])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0], EXPR$1=[$0], EXPR$2=[CAST(/($1, $2)):INTEGER NOT NULL], EXPR$3=[$0])\n LogicalAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceCase.json b/tests/calcite/testReduceCase.json index a367588..8f251f1 100644 --- a/tests/calcite/testReduceCase.json +++ b/tests/calcite/testReduceCase.json @@ -1,46 +1,46 @@ { + "help" : [ "LogicalProject(NEWCOL=[CASE(false, 2.1:FLOAT, 1:FLOAT)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(NEWCOL=[1E0:FLOAT])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "CASE", + "type" : "FLOAT", "operand" : [ { - "operator" : "false", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "false" }, { - "operator" : "2.1", + "type" : "FLOAT", "operand" : [ ], - "type" : "FLOAT" + "operator" : "2.1" }, { - "operator" : "1", + "type" : "FLOAT", "operand" : [ ], - "type" : "FLOAT" + "operator" : "1" } ], - "type" : "FLOAT" - } ], - "source" : { - "scan" : 0 - } + "operator" : "CASE" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "FLOAT" - } ], "source" : { "scan" : 0 - } + }, + "target" : [ { + "type" : "FLOAT", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(NEWCOL=[CASE(false, 2.1:FLOAT, 1:FLOAT)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(NEWCOL=[1E0:FLOAT])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceCaseNullabilityChange.json b/tests/calcite/testReduceCaseNullabilityChange.json index e2f0b9a..68c4d6b 100644 --- a/tests/calcite/testReduceCaseNullabilityChange.json +++ b/tests/calcite/testReduceCaseNullabilityChange.json @@ -1,88 +1,88 @@ { + "help" : [ "LogicalProject(QX=[CASE(=($0, 1), 1, IS NOT NULL(1), 2, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(QX=[CAST(CASE(=($0, 1), 1, 2)):INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" }, { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "CASE" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "INTEGER" + "operator" : "CASE" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalProject(QX=[CASE(=($0, 1), 1, IS NOT NULL(1), 2, null:INTEGER)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(QX=[CAST(CASE(=($0, 1), 1, 2)):INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceCastAndConsts.json b/tests/calcite/testReduceCastAndConsts.json index 3bbf4e7..810a038 100644 --- a/tests/calcite/testReduceCastAndConsts.json +++ b/tests/calcite/testReduceCastAndConsts.json @@ -1,84 +1,54 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=(CAST(+($0, /(10, 2))):INTEGER NOT NULL, 13)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=(+($0, 5), 13)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "/", + "type" : "INTEGER", "operand" : [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "INTEGER" + "operator" : "/" } ], - "type" : "INTEGER" + "operator" : "+" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "13", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "13" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -106,35 +76,65 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "5", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "5" } ], - "type" : "INTEGER" + "operator" : "+" }, { - "operator" : "13", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "13" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=(CAST(+($0, /(10, 2))):INTEGER NOT NULL, 13)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[=(+($0, 5), 13)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceCasts.json b/tests/calcite/testReduceCasts.json index 4e7f972..3ef4522 100644 --- a/tests/calcite/testReduceCasts.json +++ b/tests/calcite/testReduceCasts.json @@ -1,99 +1,50 @@ { + "help" : [ "LogicalProject(EXPR$0=[CAST($1):VARCHAR(128) NOT NULL], EXPR$1=[CAST($2):INTEGER NOT NULL])\n LogicalFilter(condition=[=(CAST(CAST($4):VARCHAR(1) NOT NULL):VARCHAR(7) NOT NULL, 'Manager')])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$3], ENAME=[$4], JOB=[$5], MGR=[$6], HIREDATE=[$7], SAL=[$8], COMM=[$9], DEPTNO1=[$10], SLACKER=[$11])\n LogicalJoin(condition=[=($2, $12)], joinType=[inner])\n LogicalProject(DEPTNO=[$0], NAME=[$1], DEPTNO0=[CAST($0):INTEGER NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[CAST($7):INTEGER NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[CAST($1):VARCHAR(128) NOT NULL], EXPR$1=[$2])\n LogicalFilter(condition=[=(CAST(CAST($4):VARCHAR(1) NOT NULL):VARCHAR(7) NOT NULL, 'Manager')])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$3], ENAME=[$4], JOB=[$5], MGR=[$6], HIREDATE=[$7], SAL=[$8], COMM=[$9], DEPTNO1=[$10], SLACKER=[$11])\n LogicalJoin(condition=[=($2, $12)], joinType=[inner])\n LogicalProject(DEPTNO=[$0], NAME=[$1], DEPTNO0=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "CAST", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "VARCHAR" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "CAST", + "type" : "VARCHAR", "operand" : [ { - "operator" : "CAST", + "type" : "VARCHAR", "operand" : [ { "column" : 4, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "CAST" } ], - "type" : "VARCHAR" + "operator" : "CAST" }, { - "operator" : "_ISO-8859-1'Manager'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'Manager'" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "TIMESTAMP" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "BOOLEAN" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -101,10 +52,13 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -112,20 +66,21 @@ "column" : 1, "type" : "VARCHAR" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "CAST" + } ] } }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -154,62 +109,17 @@ "column" : 8, "type" : "BOOLEAN" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + "operator" : "CAST" + } ] } } } - } - } - } - } - } - } - }, { - "project" : { - "target" : [ { - "operator" : "CAST", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "operator" : "CAST", - "operand" : [ { - "operator" : "CAST", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "VARCHAR" - } ], - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'Manager'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -243,12 +153,57 @@ }, { "column" : 11, "type" : "BOOLEAN" + } ] + } + } + } + }, + "target" : [ { + "type" : "VARCHAR", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "CAST" + } ] + } + }, { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "VARCHAR", + "operand" : [ { + "type" : "VARCHAR", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "operator" : "CAST" } ], + "operator" : "CAST" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'Manager'" + } ], + "operator" : "=" + }, + "source" : { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -256,10 +211,13 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -269,14 +227,15 @@ }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -307,19 +266,60 @@ }, { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "TIMESTAMP" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "BOOLEAN" + } ] } } } - } + }, + "target" : [ { + "type" : "VARCHAR", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + }, { + "column" : 2, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[CAST($1):VARCHAR(128) NOT NULL], EXPR$1=[CAST($2):INTEGER NOT NULL])\n LogicalFilter(condition=[=(CAST(CAST($4):VARCHAR(1) NOT NULL):VARCHAR(7) NOT NULL, 'Manager')])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$3], ENAME=[$4], JOB=[$5], MGR=[$6], HIREDATE=[$7], SAL=[$8], COMM=[$9], DEPTNO1=[$10], SLACKER=[$11])\n LogicalJoin(condition=[=($2, $12)], joinType=[inner])\n LogicalProject(DEPTNO=[$0], NAME=[$1], DEPTNO0=[CAST($0):INTEGER NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[CAST($7):INTEGER NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[CAST($1):VARCHAR(128) NOT NULL], EXPR$1=[$2])\n LogicalFilter(condition=[=(CAST(CAST($4):VARCHAR(1) NOT NULL):VARCHAR(7) NOT NULL, 'Manager')])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$3], ENAME=[$4], JOB=[$5], MGR=[$6], HIREDATE=[$7], SAL=[$8], COMM=[$9], DEPTNO1=[$10], SLACKER=[$11])\n LogicalJoin(condition=[=($2, $12)], joinType=[inner])\n LogicalProject(DEPTNO=[$0], NAME=[$1], DEPTNO0=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceCompositeInSubQuery.json b/tests/calcite/testReduceCompositeInSubQuery.json index f4cde78..1562a55 100644 --- a/tests/calcite/testReduceCompositeInSubQuery.json +++ b/tests/calcite/testReduceCompositeInSubQuery.json @@ -1,173 +1,93 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($7, +(40, 60)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($7, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IN", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], "query" : { "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 9, "type" : "INTEGER" }, { - "column" : 10, + "column" : 16, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + } ] } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 18, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] + } } - } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "IN" }, { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { - "operator" : "40", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "40" }, { - "operator" : "60", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "60" } ], - "type" : "INTEGER" + "operator" : "+" } ], - "type" : "BOOLEAN" + "operator" : "<" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -195,128 +115,108 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IN", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], "query" : { "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 9, "type" : "INTEGER" }, { - "column" : 10, + "column" : 16, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 18, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "INTEGER" + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "IN" }, { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : "<" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($7, +(40, 60)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(IN($0, $7, {\nLogicalProject(EMPNO=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}), <($7, 100))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstants.json b/tests/calcite/testReduceConstants.json index 1a8be05..532af0a 100644 --- a/tests/calcite/testReduceConstants.json +++ b/tests/calcite/testReduceConstants.json @@ -1,225 +1,100 @@ { + "help" : [ "LogicalProject(EXPR$0=[+(1, 2)], EXPR$1=[+($0, +(3, 4))], EXPR$2=[+(+(5, 6), $0)], EXPR$3=[null:INTEGER], EXPR$4=[CASE(IS NOT NULL(2), 2, null:INTEGER)], EXPR$5=[ROW(+(7, 8))])\n LogicalFilter(condition=[AND(=($0, +(7, 8)), =($0, +(8, 7)), =($0, CASE(IS NOT NULL(2), 2, null:INTEGER)))])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalJoin(condition=[=($0, $11)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, -(5, 5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[3], EXPR$1=[22], EXPR$2=[26], EXPR$3=[null:INTEGER], EXPR$4=[CAST(2):INTEGER], EXPR$5=[ROW(15)])\n LogicalValues(tuples=[[]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "+", - "operand" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "4", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "operator" : "+", - "operand" : [ { - "operator" : "5", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "6", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "IS NOT NULL", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "ROW", - "operand" : [ { - "operator" : "+", - "operand" : [ { - "operator" : "7", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "8", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "type" : "ROW" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" }, { - "operator" : "8", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "8" } ], - "type" : "INTEGER" + "operator" : "+" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { - "operator" : "8", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "8" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "INTEGER" + "operator" : "+" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "INTEGER" + "operator" : "CASE" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -227,13 +102,17 @@ "column" : 11, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -262,79 +141,200 @@ "column" : 8, "type" : "BOOLEAN" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "-", + "type" : "INTEGER", "operand" : [ { - "operator" : "5", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "5" }, { - "operator" : "5", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "5" } ], - "type" : "INTEGER" + "operator" : "-" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + "operator" : "+" + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ] } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ], + "operator" : "+" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "3" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "4" + } ], + "operator" : "+" + } ], + "operator" : "+" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "5" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "6" + } ], + "operator" : "+" + }, { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "+" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + } ], + "operator" : "CASE" + }, { + "type" : "ROW", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "7" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "8" + } ], + "operator" : "+" + } ], + "operator" : "ROW" + } ] } }, { "project" : { + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] + } + }, "target" : [ { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" }, { - "operator" : "22", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "22" }, { - "operator" : "26", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "26" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "ROW", + "type" : "ROW", "operand" : [ { - "operator" : "15", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "15" } ], - "type" : "ROW" - } ], - "source" : { - "values" : { - "schema" : [ "INTEGER", "VARCHAR", "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "content" : [ ] - } - } + "operator" : "ROW" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[+(1, 2)], EXPR$1=[+($0, +(3, 4))], EXPR$2=[+(+(5, 6), $0)], EXPR$3=[null:INTEGER], EXPR$4=[CASE(IS NOT NULL(2), 2, null:INTEGER)], EXPR$5=[ROW(+(7, 8))])\n LogicalFilter(condition=[AND(=($0, +(7, 8)), =($0, +(8, 7)), =($0, CASE(IS NOT NULL(2), 2, null:INTEGER)))])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalJoin(condition=[=($0, $11)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+($7, -(5, 5))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[3], EXPR$1=[22], EXPR$2=[26], EXPR$3=[null:INTEGER], EXPR$4=[CAST(2):INTEGER], EXPR$5=[ROW(15)])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstants3.json b/tests/calcite/testReduceConstants3.json index b3b755f..af51a4d 100644 --- a/tests/calcite/testReduceConstants3.json +++ b/tests/calcite/testReduceConstants3.json @@ -1,66 +1,29 @@ { + "help" : [ "LogicalProject(EXPR$0=[OR(AND(IS NULL($3), IS NULL($12)), IS TRUE(=($3, $12)))])\n LogicalFilter(condition=[IS NULL($3)])\n LogicalJoin(condition=[=($3, $12)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[IS NULL($12)])\n LogicalFilter(condition=[IS NULL($3)])\n LogicalJoin(condition=[=($3, $12)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "OR", - "operand" : [ { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS NULL", - "operand" : [ { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS TRUE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" @@ -68,44 +31,73 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 0 } } } } - } - } - }, { - "project" : { + }, "target" : [ { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { - "column" : 12, - "type" : "INTEGER" + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" + } ], + "operator" : "AND" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 12, + "type" : "INTEGER" + } ], + "operator" : "=" + } ], + "operator" : "IS TRUE" } ], - "type" : "BOOLEAN" - } ], + "operator" : "OR" + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" @@ -113,19 +105,27 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 0 } } } } - } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[OR(AND(IS NULL($3), IS NULL($12)), IS TRUE(=($3, $12)))])\n LogicalFilter(condition=[IS NULL($3)])\n LogicalJoin(condition=[=($3, $12)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[IS NULL($12)])\n LogicalFilter(condition=[IS NULL($3)])\n LogicalJoin(condition=[=($3, $12)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsCaseEquals.json b/tests/calcite/testReduceConstantsCaseEquals.json index ababbf4..677d4e4 100644 --- a/tests/calcite/testReduceConstantsCaseEquals.json +++ b/tests/calcite/testReduceConstantsCaseEquals.json @@ -1,248 +1,125 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[=(CASE(=($7, 20), 2, =($7, 10), 1, 3), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], + "column" : 7, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "1", + "operator" : "=" + }, { + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", + "operator" : "2" + }, { + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "3" + } ], + "operator" : "CASE" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 } } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", + }, + "target" : [ { + "type" : "INTEGER", "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], + "operator" : "1" + } ] + } + } + } + }, { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" }, "source" : { - "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[=(CASE(=($7, 20), 2, =($7, 10), 1, 3), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsCaseEquals2.json b/tests/calcite/testReduceConstantsCaseEquals2.json index 93c5749..8e1b431 100644 --- a/tests/calcite/testReduceConstantsCaseEquals2.json +++ b/tests/calcite/testReduceConstantsCaseEquals2.json @@ -1,248 +1,125 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[=(CASE(=($7, 20), 2, =($7, 10), 1, null:INTEGER), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], + "column" : 7, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "1", + "operator" : "=" + }, { + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", + "operator" : "2" + }, { + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + } ], + "operator" : "CASE" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 } } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", + }, + "target" : [ { + "type" : "INTEGER", "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], + "operator" : "1" + } ] + } + } + } + }, { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" }, "source" : { - "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[=(CASE(=($7, 20), 2, =($7, 10), 1, null:INTEGER), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsCaseEquals3.json b/tests/calcite/testReduceConstantsCaseEquals3.json index 9823bae..18244ef 100644 --- a/tests/calcite/testReduceConstantsCaseEquals3.json +++ b/tests/calcite/testReduceConstantsCaseEquals3.json @@ -1,308 +1,155 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[=(CASE(=($7, 30), 1, =($7, 20), 2, =($7, 10), 1, =($7, 30), 111, 0), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[SEARCH($7, Sarg[10, 30])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "111", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], + "column" : 7, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], + "operator" : "30" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "1", + "operator" : "=" + }, { + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "111", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "SEARCH", + "operator" : "2" + }, { + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "Sarg[10, 30]", + "type" : "INTEGER", "operand" : [ ], + "operator" : "10" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "30" } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "111" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "CASE" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 } } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", + }, + "target" : [ { + "type" : "INTEGER", "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], + "operator" : "1" + } ] + } + } + } + }, { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "Sarg[10, 30]" + } ], + "operator" : "SEARCH" }, "source" : { - "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "SEARCH", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "Sarg[10, 30]", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[=(CASE(=($7, 30), 1, =($7, 20), 2, =($7, 10), 1, =($7, 30), 111, 0), 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[SEARCH($7, Sarg[10, 30])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsDup.json b/tests/calcite/testReduceConstantsDup.json index f894ef4..252ee69 100644 --- a/tests/calcite/testReduceConstantsDup.json +++ b/tests/calcite/testReduceConstantsDup.json @@ -1,66 +1,66 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[AND(=($0, 7), =($0, 8))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalValues(tuples=[[]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "8", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "8" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "values" : { "schema" : [ "INTEGER", "VARCHAR" ], "content" : [ ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[AND(=($0, 7), =($0, 8))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsDup2.json b/tests/calcite/testReduceConstantsDup2.json index ccd0def..b7833f6 100644 --- a/tests/calcite/testReduceConstantsDup2.json +++ b/tests/calcite/testReduceConstantsDup2.json @@ -1,111 +1,80 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 7), =($7, 8), =($0, 10), IS NULL($3), =($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[10], ENAME=[$1], JOB=[$2], MGR=[null:INTEGER], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalValues(tuples=[[]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "8", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "8" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { - "operator" : "10", - "operand" : [ ], + "column" : 0, "type" : "INTEGER" }, { "column" : 1, @@ -114,8 +83,7 @@ "column" : 2, "type" : "VARCHAR" }, { - "operator" : "NULL", - "operand" : [ ], + "column" : 3, "type" : "INTEGER" }, { "column" : 4, @@ -132,14 +100,46 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "values" : { "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], "content" : [ ] } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(=($7, 7), =($7, 8), =($0, 10), IS NULL($3), =($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[10], ENAME=[$1], JOB=[$2], MGR=[null:INTEGER], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsDup3.json b/tests/calcite/testReduceConstantsDup3.json index 51da0d5..1de88f2 100644 --- a/tests/calcite/testReduceConstantsDup3.json +++ b/tests/calcite/testReduceConstantsDup3.json @@ -1,63 +1,63 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[OR(<>($0, 7), <>($0, 8))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : "<>" }, { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "8", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "8" } ], - "type" : "BOOLEAN" + "operator" : "<>" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[OR(<>($0, 7), <>($0, 8))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsDup3Null.json b/tests/calcite/testReduceConstantsDup3Null.json index 6124aed..0f265f9 100644 --- a/tests/calcite/testReduceConstantsDup3Null.json +++ b/tests/calcite/testReduceConstantsDup3Null.json @@ -1,75 +1,75 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(<>($3, 7), <>($3, 8))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : "<>" }, { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" }, { - "operator" : "8", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "8" } ], - "type" : "BOOLEAN" + "operator" : "<>" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(<>($3, 7), <>($3, 8))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsDupNot.json b/tests/calcite/testReduceConstantsDupNot.json index 661d055..f2015f2 100644 --- a/tests/calcite/testReduceConstantsDupNot.json +++ b/tests/calcite/testReduceConstantsDupNot.json @@ -1,67 +1,67 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[NOT(AND(=($0, 7), =($0, 8)))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "NOT", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "8", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "8" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" } ], - "type" : "BOOLEAN" + "operator" : "NOT" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[NOT(AND(=($0, 7), =($0, 8)))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsDupNot2.json b/tests/calcite/testReduceConstantsDupNot2.json index b104cc8..a95ccbc 100644 --- a/tests/calcite/testReduceConstantsDupNot2.json +++ b/tests/calcite/testReduceConstantsDupNot2.json @@ -1,78 +1,78 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[NOT(AND(=($0, 7), =($1, 'foo'), =($0, 8)))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "NOT", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'foo'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'foo'" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "8", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "8" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" } ], - "type" : "BOOLEAN" + "operator" : "NOT" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[NOT(AND(=($0, 7), =($1, 'foo'), =($0, 8)))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsDupNot2Null.json b/tests/calcite/testReduceConstantsDupNot2Null.json index 5b2fbf9..0bf9b86 100644 --- a/tests/calcite/testReduceConstantsDupNot2Null.json +++ b/tests/calcite/testReduceConstantsDupNot2Null.json @@ -1,105 +1,105 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[NOT(AND(=($3, 7), =($7, 8), =($3, 8)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IS NOT NULL($3), <>($7, 8))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "NOT", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "8", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "8" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" }, { - "operator" : "8", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "8" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" } ], - "type" : "BOOLEAN" + "operator" : "NOT" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "8", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "8" } ], - "type" : "BOOLEAN" + "operator" : "<>" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[NOT(AND(=($3, 7), =($7, 8), =($3, 8)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(IS NOT NULL($3), <>($7, 8))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsDupNotNull.json b/tests/calcite/testReduceConstantsDupNotNull.json index 9538912..627a010 100644 --- a/tests/calcite/testReduceConstantsDupNotNull.json +++ b/tests/calcite/testReduceConstantsDupNotNull.json @@ -1,79 +1,79 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[NOT(AND(=($3, 7), =($3, 8)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "NOT", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" }, { - "operator" : "8", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "8" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" } ], - "type" : "BOOLEAN" + "operator" : "NOT" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[NOT(AND(=($3, 7), =($3, 8)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IS NOT NULL($3)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsEliminatesFilter.json b/tests/calcite/testReduceConstantsEliminatesFilter.json index 7a3cc63..58354c1 100644 --- a/tests/calcite/testReduceConstantsEliminatesFilter.json +++ b/tests/calcite/testReduceConstantsEliminatesFilter.json @@ -1,78 +1,78 @@ { + "help" : [ "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalFilter(condition=[>(+(1, 2), +(3, null))])\n LogicalValues(tuples=[[{ 1, 2 }]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[]])\n" ], "schemas" : [ ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "INTEGER" + "operator" : "+" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "INTEGER" + "operator" : "+" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ [ { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ] ] } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalFilter(condition=[>(+(1, 2), +(3, null))])\n LogicalValues(tuples=[[{ 1, 2 }]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsIsNotNull.json b/tests/calcite/testReduceConstantsIsNotNull.json index 4287198..0605170 100644 --- a/tests/calcite/testReduceConstantsIsNotNull.json +++ b/tests/calcite/testReduceConstantsIsNotNull.json @@ -1,75 +1,75 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[AND(=($0, 10), IS NOT NULL($0))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[AND(=($0, 10), IS NOT NULL($0))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[=($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsIsNull.json b/tests/calcite/testReduceConstantsIsNull.json index 7972e47..712c3c1 100644 --- a/tests/calcite/testReduceConstantsIsNull.json +++ b/tests/calcite/testReduceConstantsIsNull.json @@ -1,62 +1,62 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[AND(=($0, 10), IS NULL($0))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "values" : { "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], "content" : [ ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[AND(=($0, 10), IS NULL($0))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsNegated.json b/tests/calcite/testReduceConstantsNegated.json index b8847f5..a1dc381 100644 --- a/tests/calcite/testReduceConstantsNegated.json +++ b/tests/calcite/testReduceConstantsNegated.json @@ -1,70 +1,70 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[AND(=($0, 10), NOT(=($0, 10)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "NOT", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "NOT" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "values" : { "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], "content" : [ ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[AND(=($0, 10), NOT(=($0, 10)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsNegatedInverted.json b/tests/calcite/testReduceConstantsNegatedInverted.json index 508fba0..8e23588 100644 --- a/tests/calcite/testReduceConstantsNegatedInverted.json +++ b/tests/calcite/testReduceConstantsNegatedInverted.json @@ -1,66 +1,66 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[AND(>($0, 10), <=($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "<=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "<=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "values" : { "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], "content" : [ ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[AND(>($0, 10), <=($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsNull.json b/tests/calcite/testReduceConstantsNull.json index 7323653..fd427b7 100644 --- a/tests/calcite/testReduceConstantsNull.json +++ b/tests/calcite/testReduceConstantsNull.json @@ -1,101 +1,101 @@ { + "help" : [ "LogicalProject(N=[$0])\n LogicalFilter(condition=[IS NULL($0)])\n LogicalProject(N=[$0])\n LogicalFilter(condition=[AND(IS NULL($0), IS NULL($0))])\n LogicalProject(N=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(N=[$0])\n LogicalProject(N=[$0])\n LogicalProject(N=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "project" : { - "target" : [ { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "scan" : 0 - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "project" : { - "target" : [ { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "scan" : 0 - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(N=[$0])\n LogicalFilter(condition=[IS NULL($0)])\n LogicalProject(N=[$0])\n LogicalFilter(condition=[AND(IS NULL($0), IS NULL($0))])\n LogicalProject(N=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(N=[$0])\n LogicalProject(N=[$0])\n LogicalProject(N=[null:INTEGER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsNullEqualsOne.json b/tests/calcite/testReduceConstantsNullEqualsOne.json index a18641c..26dbdbf 100644 --- a/tests/calcite/testReduceConstantsNullEqualsOne.json +++ b/tests/calcite/testReduceConstantsNullEqualsOne.json @@ -1,154 +1,78 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[=(null, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalValues(tuples=[[]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "=" }, "source" : { - "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "values" : { - "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "content" : [ ] - } - } + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "content" : [ ] } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", + }, + "target" : [ { + "type" : "INTEGER", "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "values" : { - "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "content" : [ ] - } - } - } - } - } - } + "operator" : "1" + } ] } - } ] + } } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalFilter(condition=[=(null, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalAggregate(group=[{}], EXPR$0=[COUNT()])\n LogicalProject($f0=[1])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsProjectNullable.json b/tests/calcite/testReduceConstantsProjectNullable.json index 11df9fa..9d53762 100644 --- a/tests/calcite/testReduceConstantsProjectNullable.json +++ b/tests/calcite/testReduceConstantsProjectNullable.json @@ -1,69 +1,69 @@ { + "help" : [ "LogicalProject(MGR=[$3])\n LogicalFilter(condition=[=($3, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(MGR=[CAST(10):INTEGER])\n LogicalFilter(condition=[=($3, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 3, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ] } }, { "project" : { - "target" : [ { - "operator" : "CAST", - "operand" : [ { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalProject(MGR=[$3])\n LogicalFilter(condition=[=($3, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(MGR=[CAST(10):INTEGER])\n LogicalFilter(condition=[=($3, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceConstantsRequiresExecutor.json b/tests/calcite/testReduceConstantsRequiresExecutor.json index 7a3cc63..58354c1 100644 --- a/tests/calcite/testReduceConstantsRequiresExecutor.json +++ b/tests/calcite/testReduceConstantsRequiresExecutor.json @@ -1,78 +1,78 @@ { + "help" : [ "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalFilter(condition=[>(+(1, 2), +(3, null))])\n LogicalValues(tuples=[[{ 1, 2 }]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[]])\n" ], "schemas" : [ ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "INTEGER" + "operator" : "+" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "INTEGER" + "operator" : "+" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ [ { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ] ] } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalFilter(condition=[>(+(1, 2), +(3, null))])\n LogicalValues(tuples=[[{ 1, 2 }]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[$1])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceDynamic.json b/tests/calcite/testReduceDynamic.json index dfc0fef..bc6af4b 100644 --- a/tests/calcite/testReduceDynamic.json +++ b/tests/calcite/testReduceDynamic.json @@ -1,34 +1,34 @@ { + "help" : [ "LogicalProject(USER=[USER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(USER=['happyCalciteUser':VARCHAR(2000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "USER", - "operand" : [ ], - "type" : "VARCHAR" - } ], "source" : { "scan" : 0 - } + }, + "target" : [ { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "USER" + } ] } }, { "project" : { - "target" : [ { - "operator" : "_ISO-8859-1'happyCalciteUser'", - "operand" : [ ], - "type" : "VARCHAR" - } ], "source" : { "scan" : 0 - } + }, + "target" : [ { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'happyCalciteUser'" + } ] } - } ], - "help" : [ "LogicalProject(USER=[USER])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(USER=['happyCalciteUser':VARCHAR(2000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceNestedCaseWhen.json b/tests/calcite/testReduceNestedCaseWhen.json index 1cb6f72..4a0e3be 100644 --- a/tests/calcite/testReduceNestedCaseWhen.json +++ b/tests/calcite/testReduceNestedCaseWhen.json @@ -1,126 +1,126 @@ { + "help" : [ "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[IS TRUE(CASE(=($5, 1000), IS NULL(CASE(=($5, 1000), null:INTEGER, 1)), IS NULL(CASE(=($5, 2000), null:INTEGER, 1))))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[SEARCH($5, Sarg[1000, 2000])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "IS TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "CASE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "1000", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1000" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "1000", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1000" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "INTEGER" + "operator" : "CASE" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "2000", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2000" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "INTEGER" + "operator" : "CASE" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" } ], - "type" : "BOOLEAN" + "operator" : "CASE" } ], - "type" : "BOOLEAN" + "operator" : "IS TRUE" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 5, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "SEARCH", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "Sarg[1000, 2000]", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "Sarg[1000, 2000]" } ], - "type" : "BOOLEAN" + "operator" : "SEARCH" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[IS TRUE(CASE(=($5, 1000), IS NULL(CASE(=($5, 1000), null:INTEGER, 1)), IS NULL(CASE(=($5, 2000), null:INTEGER, 1))))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[SEARCH($5, Sarg[1000, 2000])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceNullableToNotNull.json b/tests/calcite/testReduceNullableToNotNull.json index f6fbfe2..4ffb1e8 100644 --- a/tests/calcite/testReduceNullableToNotNull.json +++ b/tests/calcite/testReduceNullableToNotNull.json @@ -1,68 +1,68 @@ { + "help" : [ "LogicalProject(NEWCOL=[+($0, CASE(=('a', 'a'), 1, null:INTEGER))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(NEWCOL=[+($0, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "_ISO-8859-1'a'", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "_ISO-8859-1'a'" }, { - "operator" : "_ISO-8859-1'a'", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "_ISO-8859-1'a'" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "INTEGER" + "operator" : "CASE" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "+" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "+" + } ] } - } ], - "help" : [ "LogicalProject(NEWCOL=[+($0, CASE(=('a', 'a'), 1, null:INTEGER))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(NEWCOL=[+($0, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceNullableToNotNull2.json b/tests/calcite/testReduceNullableToNotNull2.json index f6fbfe2..4ffb1e8 100644 --- a/tests/calcite/testReduceNullableToNotNull2.json +++ b/tests/calcite/testReduceNullableToNotNull2.json @@ -1,68 +1,68 @@ { + "help" : [ "LogicalProject(NEWCOL=[+($0, CASE(=('a', 'a'), 1, null:INTEGER))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(NEWCOL=[+($0, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "_ISO-8859-1'a'", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "_ISO-8859-1'a'" }, { - "operator" : "_ISO-8859-1'a'", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "_ISO-8859-1'a'" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" } ], - "type" : "INTEGER" + "operator" : "CASE" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "+" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "+" + } ] } - } ], - "help" : [ "LogicalProject(NEWCOL=[+($0, CASE(=('a', 'a'), 1, null:INTEGER))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(NEWCOL=[+($0, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceOrCaseWhen.json b/tests/calcite/testReduceOrCaseWhen.json index 9f342e4..0070d9b 100644 --- a/tests/calcite/testReduceOrCaseWhen.json +++ b/tests/calcite/testReduceOrCaseWhen.json @@ -1,111 +1,111 @@ { + "help" : [ "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[OR(IS NULL(CASE(=($5, 1000), null:INTEGER, 1)), IS NULL(CASE(=($5, 2000), null:INTEGER, 1)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[SEARCH($5, Sarg[1000, 2000])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "1000", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1000" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "INTEGER" + "operator" : "CASE" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "2000", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2000" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "INTEGER" + "operator" : "CASE" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 5, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "SEARCH", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "Sarg[1000, 2000]", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "Sarg[1000, 2000]" } ], - "type" : "BOOLEAN" + "operator" : "SEARCH" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[OR(IS NULL(CASE(=($5, 1000), null:INTEGER, 1)), IS NULL(CASE(=($5, 2000), null:INTEGER, 1)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[SEARCH($5, Sarg[1000, 2000])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceValuesToEmpty.json b/tests/calcite/testReduceValuesToEmpty.json index 76abb4e..70e9030 100644 --- a/tests/calcite/testReduceValuesToEmpty.json +++ b/tests/calcite/testReduceValuesToEmpty.json @@ -1,30 +1,14 @@ { + "help" : [ "LogicalProject(X=[+($0, $1)], B=[$1], A=[$0])\n LogicalFilter(condition=[<(-($0, $1), 0)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 7 }]])\n", "LogicalValues(tuples=[[]])\n" ], "schemas" : [ ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "+", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "-", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -32,44 +16,60 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "-" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], [ { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ] ] } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "+" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ] } }, { "values" : { "schema" : [ "INTEGER", "INTEGER", "INTEGER" ], "content" : [ ] } - } ], - "help" : [ "LogicalProject(X=[+($0, $1)], B=[$1], A=[$0])\n LogicalFilter(condition=[<(-($0, $1), 0)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 7 }]])\n", "LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceValuesUnderFilter.json b/tests/calcite/testReduceValuesUnderFilter.json index 784a63b..4b78018 100644 --- a/tests/calcite/testReduceValuesUnderFilter.json +++ b/tests/calcite/testReduceValuesUnderFilter.json @@ -1,77 +1,77 @@ { + "help" : [ "LogicalProject(A=[$0], B=[$1])\n LogicalFilter(condition=[<($0, 15)])\n LogicalValues(tuples=[[{ 10, 'x' }, { 20, 'y' }]])\n", "LogicalProject(A=[$0], B=[$1])\n LogicalValues(tuples=[[{ 10, 'x' }]])\n" ], "schemas" : [ ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "CHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "15", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "15" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "values" : { "schema" : [ "INTEGER", "CHAR" ], "content" : [ [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { - "operator" : "_ISO-8859-1'x'", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "_ISO-8859-1'x'" } ], [ { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" }, { - "operator" : "_ISO-8859-1'y'", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "_ISO-8859-1'y'" } ] ] } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "CHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "values" : { "schema" : [ "INTEGER", "CHAR" ], "content" : [ [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { - "operator" : "_ISO-8859-1'x'", + "type" : "CHAR", "operand" : [ ], - "type" : "CHAR" + "operator" : "_ISO-8859-1'x'" } ] ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "CHAR" + } ] } - } ], - "help" : [ "LogicalProject(A=[$0], B=[$1])\n LogicalFilter(condition=[<($0, 15)])\n LogicalValues(tuples=[[{ 10, 'x' }, { 20, 'y' }]])\n", "LogicalProject(A=[$0], B=[$1])\n LogicalValues(tuples=[[{ 10, 'x' }]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceValuesUnderProject.json b/tests/calcite/testReduceValuesUnderProject.json index 718e7e6..f7a8459 100644 --- a/tests/calcite/testReduceValuesUnderProject.json +++ b/tests/calcite/testReduceValuesUnderProject.json @@ -1,54 +1,54 @@ { + "help" : [ "LogicalProject(EXPR$0=[+($0, $1)])\n LogicalValues(tuples=[[{ 10, 1 }, { 20, 3 }]])\n", "LogicalValues(tuples=[[{ 11 }, { 23 }]])\n" ], "schemas" : [ ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "+", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], [ { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" } ] ] } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "+" + } ] } }, { "values" : { "schema" : [ "INTEGER" ], "content" : [ [ { - "operator" : "11", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "11" } ], [ { - "operator" : "23", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "23" } ] ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[+($0, $1)])\n LogicalValues(tuples=[[{ 10, 1 }, { 20, 3 }]])\n", "LogicalValues(tuples=[[{ 11 }, { 23 }]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceValuesUnderProjectFilter.json b/tests/calcite/testReduceValuesUnderProjectFilter.json index 656d296..a30fa44 100644 --- a/tests/calcite/testReduceValuesUnderProjectFilter.json +++ b/tests/calcite/testReduceValuesUnderProjectFilter.json @@ -1,30 +1,14 @@ { + "help" : [ "LogicalProject(X=[+($0, $1)], B=[$1], A=[$0])\n LogicalFilter(condition=[<(-($0, $1), 21)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 7 }, { 20, 3 }]])\n", "LogicalValues(tuples=[[{ 11, 1, 10 }, { 23, 3, 20 }]])\n" ], "schemas" : [ ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "+", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "-", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -32,76 +16,92 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "-" }, { - "operator" : "21", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "21" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "values" : { "schema" : [ "INTEGER", "INTEGER" ], "content" : [ [ { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], [ { - "operator" : "30", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "30" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], [ { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" } ] ] } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "+" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ] } }, { "values" : { "schema" : [ "INTEGER", "INTEGER", "INTEGER" ], "content" : [ [ { - "operator" : "11", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "11" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], [ { - "operator" : "23", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "23" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" }, { - "operator" : "20", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ] ] } - } ], - "help" : [ "LogicalProject(X=[+($0, $1)], B=[$1], A=[$0])\n LogicalFilter(condition=[<(-($0, $1), 21)])\n LogicalValues(tuples=[[{ 10, 1 }, { 30, 7 }, { 20, 3 }]])\n", "LogicalValues(tuples=[[{ 11, 1, 10 }, { 23, 3, 20 }]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testReduceWithNonTypePredicate.json b/tests/calcite/testReduceWithNonTypePredicate.json index 154fe2e..9060a7c 100644 --- a/tests/calcite/testReduceWithNonTypePredicate.json +++ b/tests/calcite/testReduceWithNonTypePredicate.json @@ -1,207 +1,147 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[AVG($0)], EXPR$1=[AVG($0) WITHIN DISTINCT ($1)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[CAST(/($1, $2)):INTEGER])\n LogicalProject(EXPR$0=[$0], $f1=[CASE(=($2, 0), null:INTEGER, $1)], $f2=[$2])\n LogicalAggregate(group=[{}], EXPR$0=[AVG($0)], agg#1=[$SUM0($0) WITHIN DISTINCT ($1)], agg#2=[COUNT() WITHIN DISTINCT ($1)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "AVG", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "scan" : 0 + }, + "target" : [ { + "column" : 5, "type" : "INTEGER" }, { - "operator" : "AVG", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "column" : 7, "type" : "INTEGER" - } ], + } ] + } + } + } + }, { + "project" : { + "source" : { + "project" : { "source" : { - "filter" : { - "condition" : { - "operator" : "AND", + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", "operand" : [ ], - "type" : "BOOLEAN" - }, + "operator" : "COUNT", + "ignoreNulls" : false + } ], "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 5, "type" : "INTEGER" }, { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } } - } - } - } ] - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "CAST", - "operand" : [ { - "operator" : "/", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "BIGINT" - } ], - "type" : "BIGINT" - } ], - "type" : "INTEGER" - } ], - "source" : { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" }, { "column" : 1, "type" : "INTEGER" } ], + "operator" : "CASE" + }, { + "column" : 2, + "type" : "BIGINT" + } ] + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BIGINT", + "operand" : [ { + "column" : 1, "type" : "INTEGER" }, { "column" : 2, "type" : "BIGINT" } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "AVG", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "$SUM0", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } + "operator" : "/" + } ], + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[AVG($0)], EXPR$1=[AVG($0) WITHIN DISTINCT ($1)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[$0], EXPR$1=[CAST(/($1, $2)):INTEGER])\n LogicalProject(EXPR$0=[$0], $f1=[CASE(=($2, 0), null:INTEGER, $1)], $f2=[$2])\n LogicalAggregate(group=[{}], EXPR$0=[AVG($0)], agg#1=[$SUM0($0) WITHIN DISTINCT ($1)], agg#2=[COUNT() WITHIN DISTINCT ($1)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testRemoveDistinctOnAgg.json b/tests/calcite/testRemoveDistinctOnAgg.json index df61d12..1951bfb 100644 --- a/tests/calcite/testRemoveDistinctOnAgg.json +++ b/tests/calcite/testRemoveDistinctOnAgg.json @@ -1,14 +1,98 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], EXPR$1=[$2], EXPR$2=[$3], EXPR$3=[$3], EXPR$4=[$4], EXPR$5=[$5], EXPR$6=[$6], EXPR$7=[$7])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM(DISTINCT $2)], EXPR$2=[MIN($2)], EXPR$4=[MAX($2)], EXPR$5=[BIT_AND($2)], EXPR$6=[BIT_OR($2)], EXPR$7=[COUNT(DISTINCT $2)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], EXPR$1=[$5], EXPR$2=[$5], EXPR$3=[$5], EXPR$4=[$5], EXPR$5=[$5], EXPR$6=[$5], EXPR$7=[1:BIGINT])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : true, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "BIT_AND", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "BIT_OR", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ] + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -33,146 +117,13 @@ }, { "column" : 7, "type" : "BIGINT" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "BIT_AND", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "BIT_OR", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -195,14 +146,10 @@ "column" : 5, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "BIGINT", "operand" : [ ], - "type" : "BIGINT" - } ], - "source" : { - "scan" : 0 - } + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], EXPR$1=[$2], EXPR$2=[$3], EXPR$3=[$3], EXPR$4=[$4], EXPR$5=[$5], EXPR$6=[$6], EXPR$7=[$7])\n LogicalAggregate(group=[{0, 1}], EXPR$1=[SUM(DISTINCT $2)], EXPR$2=[MIN($2)], EXPR$4=[MAX($2)], EXPR$5=[BIT_AND($2)], EXPR$6=[BIT_OR($2)], EXPR$7=[COUNT(DISTINCT $2)])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7], SAL=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], EXPR$1=[$5], EXPR$2=[$5], EXPR$3=[$5], EXPR$4=[$5], EXPR$5=[$5], EXPR$6=[$5], EXPR$7=[1:BIGINT])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testRemoveSemiJoin.json b/tests/calcite/testRemoveSemiJoin.json index a7ddb6c..ad63a2c 100644 --- a/tests/calcite/testRemoveSemiJoin.json +++ b/tests/calcite/testRemoveSemiJoin.json @@ -1,29 +1,26 @@ { + "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[=($7, $9)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -31,38 +28,37 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -70,17 +66,21 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[=($7, $9)])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testRemoveSemiJoinRight.json b/tests/calcite/testRemoveSemiJoinRight.json index 2530477..0ca35d3 100644 --- a/tests/calcite/testRemoveSemiJoinRight.json +++ b/tests/calcite/testRemoveSemiJoinRight.json @@ -1,31 +1,28 @@ { + "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($9, $18))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($9, $18)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -33,9 +30,9 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" @@ -43,53 +40,52 @@ "column" : 18, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } }, + "kind" : "INNER", "right" : { "scan" : 0 } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" @@ -97,13 +93,12 @@ "column" : 18, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -111,22 +106,27 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($9, $18))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($9, $18)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testRemoveSemiJoinRightWithFilter.json b/tests/calcite/testRemoveSemiJoinRightWithFilter.json index 5f04604..1bc27ab 100644 --- a/tests/calcite/testRemoveSemiJoinRightWithFilter.json +++ b/tests/calcite/testRemoveSemiJoinRightWithFilter.json @@ -1,31 +1,28 @@ { + "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($9, $18), =($10, 'foo'))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($9, $18)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($1, 'foo')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -33,9 +30,9 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" @@ -43,64 +40,63 @@ "column" : 18, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'foo'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'foo'" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } }, + "kind" : "INNER", "right" : { "scan" : 0 } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" @@ -108,13 +104,12 @@ "column" : 18, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -122,24 +117,25 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'foo'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'foo'" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 1 @@ -148,12 +144,16 @@ } } }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($9, $18), =($10, 'foo'))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($9, $18)], joinType=[inner], semiJoinDone=[true])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($1, 'foo')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testRemoveSemiJoinWithFilter.json b/tests/calcite/testRemoveSemiJoinWithFilter.json index a8822ac..c321988 100644 --- a/tests/calcite/testRemoveSemiJoinWithFilter.json +++ b/tests/calcite/testRemoveSemiJoinWithFilter.json @@ -1,31 +1,28 @@ { + "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($1, 'foo'))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalFilter(condition=[=($1, 'foo')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -33,51 +30,50 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'foo'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'foo'" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -85,33 +81,37 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'foo'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'foo'" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(ENAME=[$1])\n LogicalFilter(condition=[AND(=($7, $9), =($1, 'foo'))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(ENAME=[$1])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner], semiJoinDone=[true])\n LogicalFilter(condition=[=($1, 'foo')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testRightEmptyAntiJoin.json b/tests/calcite/testRightEmptyAntiJoin.json index 8567e15..991caf5 100644 --- a/tests/calcite/testRightEmptyAntiJoin.json +++ b/tests/calcite/testRightEmptyAntiJoin.json @@ -1,23 +1,19 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($7, $8)], joinType=[anti])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n", "LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[scott, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true, true, true, true, true, true ], + "name" : "scott.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "key" : [ [ 0 ], [ 1 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "SMALLINT" - } ], "source" : { "join" : { - "kind" : "ANTI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "TINYINT" @@ -25,11 +21,12 @@ "column" : 8, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "ANTI", "right" : { "values" : { "schema" : [ "TINYINT", "VARCHAR", "VARCHAR" ], @@ -37,18 +34,21 @@ } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "SMALLINT" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "SMALLINT" - } ], - "source" : { - "scan" : 0 - } + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($7, $8)], joinType=[anti])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n", "LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[scott, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testRightEmptyAntiJoinNonEqui.json b/tests/calcite/testRightEmptyAntiJoinNonEqui.json index 98f88b0..438d1e6 100644 --- a/tests/calcite/testRightEmptyAntiJoinNonEqui.json +++ b/tests/calcite/testRightEmptyAntiJoinNonEqui.json @@ -1,25 +1,21 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[AND(=($7, $8), =($5, 2000))], joinType=[anti])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n", "LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[scott, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true, true, true, true, true, true ], + "name" : "scott.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "key" : [ [ 0 ], [ 1 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "SMALLINT" - } ], "source" : { "join" : { - "kind" : "ANTI", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "TINYINT" @@ -27,24 +23,25 @@ "column" : 8, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "DECIMAL" }, { - "operator" : "2000", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2000" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "scan" : 0 }, + "kind" : "ANTI", "right" : { "values" : { "schema" : [ "TINYINT", "VARCHAR", "VARCHAR" ], @@ -52,18 +49,21 @@ } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "SMALLINT" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "SMALLINT" - } ], - "source" : { - "scan" : 0 - } + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[AND(=($7, $8), =($5, 2000))], joinType=[anti])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n", "LogicalProject(EMPNO=[$0])\n LogicalTableScan(table=[[scott, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testRightEmptyFullJoin.json b/tests/calcite/testRightEmptyFullJoin.json index 2afc1f9..ba37c0b 100644 --- a/tests/calcite/testRightEmptyFullJoin.json +++ b/tests/calcite/testRightEmptyFullJoin.json @@ -1,21 +1,64 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalProject(EMPNO=[CAST($0):INTEGER], ENAME=[CAST($1):VARCHAR(20)], JOB=[CAST($2):VARCHAR(10)], MGR=[$3], HIREDATE=[CAST($4):TIMESTAMP(0)], SAL=[CAST($5):INTEGER], COMM=[CAST($6):INTEGER], DEPTNO=[CAST($7):INTEGER], SLACKER=[CAST($8):BOOLEAN], DEPTNO0=[null:INTEGER], NAME=[null:VARCHAR(10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "FULL", + "right" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, + "source" : { + "scan" : 1 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -49,52 +92,85 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "type" : "INTEGER", "operand" : [ { - "column" : 7, + "column" : 0, "type" : "INTEGER" - }, { - "column" : 9, + } ], + "operator" : "CAST" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "type" : "TIMESTAMP", + "operand" : [ { + "column" : 4, + "type" : "TIMESTAMP" + } ], + "operator" : "CAST" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 5, "type" : "INTEGER" } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "false", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } + "operator" : "CAST" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + } ], + "operator" : "CAST" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "CAST" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 8, + "type" : "BOOLEAN" + } ], + "operator" : "CAST" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "NULL" + } ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -128,33 +204,7 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "FULL", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "values" : { - "schema" : [ "INTEGER", "VARCHAR" ], - "content" : [ ] - } - } - } - } + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[full])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testRightEmptyInnerJoin.json b/tests/calcite/testRightEmptyInnerJoin.json index 8b5e717..25863f1 100644 --- a/tests/calcite/testRightEmptyInnerJoin.json +++ b/tests/calcite/testRightEmptyInnerJoin.json @@ -1,21 +1,64 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, + "source" : { + "scan" : 1 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -49,52 +92,16 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "false", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } - } - } + } ] } }, { "project" : { + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN", "INTEGER", "VARCHAR" ], + "content" : [ ] + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -128,14 +135,7 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], - "source" : { - "values" : { - "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN", "INTEGER", "VARCHAR" ], - "content" : [ ] - } - } + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testRightEmptyLeftJoin.json b/tests/calcite/testRightEmptyLeftJoin.json index 62bc97b..3a2fa4c 100644 --- a/tests/calcite/testRightEmptyLeftJoin.json +++ b/tests/calcite/testRightEmptyLeftJoin.json @@ -1,21 +1,64 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[null:INTEGER], NAME=[null:VARCHAR(10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, + "source" : { + "scan" : 1 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -49,52 +92,53 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { + "project" : { + "source" : { "scan" : 0 }, - "right" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "false", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "NULL" + } ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -128,33 +172,7 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "LEFT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "values" : { - "schema" : [ "INTEGER", "VARCHAR" ], - "content" : [ ] - } - } - } - } + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testRightEmptyRightJoin.json b/tests/calcite/testRightEmptyRightJoin.json index ac6cd20..0603c0e 100644 --- a/tests/calcite/testRightEmptyRightJoin.json +++ b/tests/calcite/testRightEmptyRightJoin.json @@ -1,21 +1,64 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "RIGHT", + "right" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, + "source" : { + "scan" : 1 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -49,52 +92,16 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "false", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } - } - } + } ] } }, { "project" : { + "source" : { + "values" : { + "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN", "INTEGER", "VARCHAR" ], + "content" : [ ] + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -128,14 +135,7 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], - "source" : { - "values" : { - "schema" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN", "INTEGER", "VARCHAR" ], - "content" : [ ] - } - } + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalFilter(condition=[false])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testRightEmptySemiJoin.json b/tests/calcite/testRightEmptySemiJoin.json index 9c622db..d76257c 100644 --- a/tests/calcite/testRightEmptySemiJoin.json +++ b/tests/calcite/testRightEmptySemiJoin.json @@ -1,23 +1,19 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($7, $8)], joinType=[semi])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n", "LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true, true, true, true, true, true ], + "name" : "scott.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "key" : [ [ 0 ], [ 1 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "SMALLINT" - } ], "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "TINYINT" @@ -25,11 +21,12 @@ "column" : 8, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { "values" : { "schema" : [ "TINYINT", "VARCHAR", "VARCHAR" ], @@ -37,21 +34,24 @@ } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "SMALLINT" - } ], + } ] + } + }, { + "project" : { "source" : { "values" : { "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], "content" : [ ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "SMALLINT" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalJoin(condition=[=($7, $8)], joinType=[semi])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n", "LogicalProject(EMPNO=[$0])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testRightOuterJoinSimplificationToInner.json b/tests/calcite/testRightOuterJoinSimplificationToInner.json index ae0d0e8..ef8e17c 100644 --- a/tests/calcite/testRightOuterJoinSimplificationToInner.json +++ b/tests/calcite/testRightOuterJoinSimplificationToInner.json @@ -1,45 +1,40 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalJoin(condition=[=($0, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalProject(DEPTNO=[CAST($0):INTEGER], NAME=[CAST($1):VARCHAR(10)], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" }, { - "operator" : "_ISO-8859-1'Charlie'", + "type" : "VARCHAR", "operand" : [ ], - "type" : "VARCHAR" + "operator" : "_ISO-8859-1'Charlie'" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "join" : { - "kind" : "RIGHT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -47,42 +42,81 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "RIGHT", "right" : { "scan" : 1 } } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'Charlie'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "kind" : "INNER", + "right" : { + "scan" : 1 + } + } + }, "target" : [ { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "VARCHAR", "operand" : [ { "column" : 1, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "CAST" }, { "column" : 2, "type" : "INTEGER" @@ -110,48 +144,14 @@ }, { "column" : 10, "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'Charlie'", - "operand" : [ ], - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "scan" : 1 - } - } - } + } ] } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalJoin(condition=[=($0, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalProject(DEPTNO=[CAST($0):INTEGER], NAME=[CAST($1):VARCHAR(10)], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalFilter(condition=[=($1, 'Charlie')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSelectAnyCorrelated.json b/tests/calcite/testSelectAnyCorrelated.json new file mode 100644 index 0000000..516d50f --- /dev/null +++ b/tests/calcite/testSelectAnyCorrelated.json @@ -0,0 +1,323 @@ +{ + "help" : [ "LogicalProject(variablesSet=[[$cor0]], EXPR$0=[> SOME($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[CAST(OR(AND(IS TRUE(>($0, $9)), IS NOT TRUE(OR(IS NULL($12), =($10, 0)))), AND(IS TRUE(>($10, $11)), null, IS NOT TRUE(OR(IS NULL($12), =($10, 0))), IS NOT TRUE(>($0, $9))), AND(>($0, $9), IS NOT TRUE(OR(IS NULL($12), =($10, 0))), IS NOT TRUE(>($0, $9)), IS NOT TRUE(>($10, $11))))):BOOLEAN NOT NULL])\n LogicalJoin(condition=[=($2, $13)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(m=[$1], c=[$2], d=[$2], trueLiteral=[true], NAME=[$0])\n LogicalAggregate(group=[{0}], m=[MIN($1)], c=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], + "schemas" : [ { + "types" : [ "INTEGER", "VARCHAR" ], + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + } ], + "queries" : [ { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "query" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ] + } + }, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "> SOME" + } ] + } + }, { + "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 13, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 1 + }, + "kind" : "LEFT", + "right" : { + "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "column" : 0, + "type" : "VARCHAR" + } ] + } + } + } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : ">" + } ], + "operator" : "IS TRUE" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 12, + "type" : "BOOLEAN" + } ], + "operator" : "IS NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + } ], + "operator" : "OR" + } ], + "operator" : "IS NOT TRUE" + } ], + "operator" : "AND" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "column" : 11, + "type" : "BIGINT" + } ], + "operator" : ">" + } ], + "operator" : "IS TRUE" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 12, + "type" : "BOOLEAN" + } ], + "operator" : "IS NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + } ], + "operator" : "OR" + } ], + "operator" : "IS NOT TRUE" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : ">" + } ], + "operator" : "IS NOT TRUE" + } ], + "operator" : "AND" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : ">" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 12, + "type" : "BOOLEAN" + } ], + "operator" : "IS NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + } ], + "operator" : "OR" + } ], + "operator" : "IS NOT TRUE" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : ">" + } ], + "operator" : "IS NOT TRUE" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + }, { + "column" : 11, + "type" : "BIGINT" + } ], + "operator" : ">" + } ], + "operator" : "IS NOT TRUE" + } ], + "operator" : "AND" + } ], + "operator" : "OR" + } ], + "operator" : "CAST" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testSelectNotInCorrelated.json b/tests/calcite/testSelectNotInCorrelated.json new file mode 100644 index 0000000..2f8f104 --- /dev/null +++ b/tests/calcite/testSelectNotInCorrelated.json @@ -0,0 +1,131 @@ +{ + "help" : [ "LogicalProject(variablesSet=[[$cor0]], SAL=[$5], EXPR$1=[NOT(IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n}))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5], EXPR$1=[IS NULL($10)])\n LogicalJoin(condition=[AND(=($0, $9), =($2, $11))], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], i=[true], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], + "schemas" : [ { + "types" : [ "INTEGER", "VARCHAR" ], + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + } ], + "queries" : [ { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "query" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 10, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ] + } + }, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "IN" + } ], + "operator" : "NOT" + } ] + } + }, { + "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + } ], + "operator" : "=" + } ], + "operator" : "AND" + }, + "left" : { + "scan" : 1 + }, + "kind" : "LEFT", + "right" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] + } + } + } + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 10, + "type" : "BOOLEAN" + } ], + "operator" : "IS NULL" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testSemiCorrelateWithLeftEmpty.json b/tests/calcite/testSemiCorrelateWithLeftEmpty.json new file mode 100644 index 0000000..9b2c9bf --- /dev/null +++ b/tests/calcite/testSemiCorrelateWithLeftEmpty.json @@ -0,0 +1,45 @@ +{ + "help" : [ "LogicalCorrelate(correlation=[$cor0], joinType=[semi], requiredColumns=[{7}])\n LogicalValues(tuples=[[]])\n LogicalFilter(condition=[=($cor0.DEPTNO, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalValues(tuples=[[]])\n" ], + "schemas" : [ { + "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "nullable" : [ false, true, true ], + "name" : "scott.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ] + } ], + "queries" : [ { + "correlate" : { + "left" : { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "content" : [ ] + } + }, + "kind" : "SEMI", + "right" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "TINYINT" + }, { + "column" : 8, + "type" : "TINYINT" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "content" : [ ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testSemiCorrelateWithRightEmpty.json b/tests/calcite/testSemiCorrelateWithRightEmpty.json new file mode 100644 index 0000000..82789b5 --- /dev/null +++ b/tests/calcite/testSemiCorrelateWithRightEmpty.json @@ -0,0 +1,30 @@ +{ + "help" : [ "LogicalCorrelate(correlation=[$cor0], joinType=[semi], requiredColumns=[{7}])\n LogicalTableScan(table=[[scott, EMP]])\n LogicalValues(tuples=[[]])\n", "LogicalValues(tuples=[[]])\n" ], + "schemas" : [ { + "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "nullable" : [ false, true, true, true, true, true, true, true ], + "name" : "scott.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "key" : [ [ 0 ], [ 1 ] ] + } ], + "queries" : [ { + "correlate" : { + "left" : { + "scan" : 0 + }, + "kind" : "SEMI", + "right" : { + "values" : { + "schema" : [ "TINYINT", "VARCHAR", "VARCHAR" ], + "content" : [ ] + } + } + } + }, { + "values" : { + "schema" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], + "content" : [ ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testSemiJoinProjectTranspose.json b/tests/calcite/testSemiJoinProjectTranspose.json index b0011b1..d9e44b4 100644 --- a/tests/calcite/testSemiJoinProjectTranspose.json +++ b/tests/calcite/testSemiJoinProjectTranspose.json @@ -1,30 +1,19 @@ { + "help" : [ "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[semi])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalProject($f0=[$0])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "DNAME", "LOC" ], "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ], [ 2 ] ], - "foreign" : [ ] - }, { - "name" : "DEPT", + "nullable" : [ false, true, true ], + "name" : "scott.DEPT", + "guaranteed" : [ ], "fields" : [ "DEPTNO", "DNAME", "LOC" ], - "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ], [ 2 ] ], - "foreign" : [ ] + "key" : [ [ 0 ], [ 1 ], [ 2 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "TINYINT" @@ -32,98 +21,53 @@ "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "operator" : "*", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "TINYINT" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "*", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "TINYINT" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } + "scan" : 0 + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + }, { + "column" : 0, + "type" : "TINYINT" + } ], + "operator" : "*" + } ] } - } ] + } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "TINYINT" @@ -131,106 +75,65 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "TINYINT" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } }, + "kind" : "SEMI", "right" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { - "operator" : "*", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 0, - "type" : "TINYINT" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "*", - "operand" : [ { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "TINYINT" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "scan" : 0 + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + }, { + "column" : 0, + "type" : "TINYINT" + } ], + "operator" : "*" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[semi])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n", "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalProject(DEPTNO=[$0], DNAME=[$1])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalProject($f0=[$0])\n LogicalAggregate(group=[{0}])\n LogicalProject($f0=[*(2, $0)])\n LogicalTableScan(table=[[scott, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSemiJoinReduceConstants.json b/tests/calcite/testSemiJoinReduceConstants.json index 97ea134..24a6ad1 100644 --- a/tests/calcite/testSemiJoinReduceConstants.json +++ b/tests/calcite/testSemiJoinReduceConstants.json @@ -1,23 +1,19 @@ { + "help" : [ "LogicalProject(SAL=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\n LogicalFilter(condition=[=($1, 200)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[=($0, 100)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$0])\n LogicalJoin(condition=[=(200, $2)], joinType=[semi])\n LogicalFilter(condition=[=($1, 200)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[=($0, 100)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "INTEGER" @@ -25,171 +21,175 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "INTEGER" }, { - "operator" : "200", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "200" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 5, "type" : "INTEGER" }, { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } } }, + "kind" : "SEMI", "right" : { "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 5, "type" : "INTEGER" }, { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ] } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "200", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "200" }, { "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "INTEGER" }, { - "operator" : "200", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "200" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 5, "type" : "INTEGER" }, { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } } }, + "kind" : "SEMI", "right" : { "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 5, "type" : "INTEGER" }, { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(SAL=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\n LogicalFilter(condition=[=($1, 200)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[=($0, 100)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$0])\n LogicalJoin(condition=[=(200, $2)], joinType=[semi])\n LogicalFilter(condition=[=($1, 200)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[=($0, 100)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSemiJoinRule.json b/tests/calcite/testSemiJoinRule.json index 3674681..47794d0 100644 --- a/tests/calcite/testSemiJoinRule.json +++ b/tests/calcite/testSemiJoinRule.json @@ -1,33 +1,26 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -35,108 +28,62 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "100", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "100", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } + "scan" : 1 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } - } ] + } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] } }, { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -144,39 +91,39 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } } } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSemiJoinRuleExists.json b/tests/calcite/testSemiJoinRuleExists.json index 3674681..47794d0 100644 --- a/tests/calcite/testSemiJoinRuleExists.json +++ b/tests/calcite/testSemiJoinRuleExists.json @@ -1,33 +1,26 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -35,108 +28,62 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "100", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "100", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } + "scan" : 1 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } - } ] + } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] } }, { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -144,39 +91,39 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } } } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSemiJoinRuleLeft.json b/tests/calcite/testSemiJoinRuleLeft.json index 1adb44f..0584c17 100644 --- a/tests/calcite/testSemiJoinRuleLeft.json +++ b/tests/calcite/testSemiJoinRuleLeft.json @@ -1,30 +1,26 @@ { + "help" : [ "LogicalProject(NAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -32,113 +28,64 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "100", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "100", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } + "scan" : 1 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } - } ] + } } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } - } ], - "help" : [ "LogicalProject(NAME=[$1])\n LogicalJoin(condition=[=($0, $2)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSemiJoinRuleWithHint.json b/tests/calcite/testSemiJoinRuleWithHint.json index a94df15..347ede9 100644 --- a/tests/calcite/testSemiJoinRuleWithHint.json +++ b/tests/calcite/testSemiJoinRuleWithHint.json @@ -1,30 +1,26 @@ { + "help" : [ "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[scott, EMP]])\n", "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[semi])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[scott, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "DNAME", "LOC" ], "types" : [ "TINYINT", "VARCHAR", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ], [ 2 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true ], + "name" : "scott.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "DNAME", "LOC" ], + "key" : [ [ 0 ], [ 1 ], [ 2 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], "types" : [ "SMALLINT", "VARCHAR", "VARCHAR", "SMALLINT", "DATE", "DECIMAL", "DECIMAL", "TINYINT" ], - "strategy" : [ "NOT_NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE", "NULLABLE" ], - "key" : [ [ 0 ], [ 1 ] ], - "foreign" : [ ] + "nullable" : [ false, true, true, true, true, true, true, true ], + "name" : "scott.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO" ], + "key" : [ [ 0 ], [ 1 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "TINYINT" @@ -32,82 +28,45 @@ "column" : 3, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "TINYINT" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "TINYINT" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "TINYINT" - } ], - "source" : { - "scan" : 1 - } - } - } + } ] } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "TINYINT" - }, { - "column" : 1, - "type" : "TINYINT" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "TINYINT" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } ] + } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "TINYINT" @@ -115,25 +74,29 @@ "column" : 3, "type" : "TINYINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 7, "type" : "TINYINT" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[inner])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[scott, EMP]])\n", "LogicalProject(DNAME=[$1])\n LogicalJoin(condition=[=($0, $3)], joinType=[semi])\n LogicalTableScan(table=[[scott, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[scott, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSemiJoinRuleWithJoinOnUniqueInput.json b/tests/calcite/testSemiJoinRuleWithJoinOnUniqueInput.json index fc36dde..798b23c 100644 --- a/tests/calcite/testSemiJoinRuleWithJoinOnUniqueInput.json +++ b/tests/calcite/testSemiJoinRuleWithJoinOnUniqueInput.json @@ -1,21 +1,52 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -43,43 +74,12 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } + } ] } }, { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -87,23 +87,23 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalJoin(condition=[=($7, $9)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSemiJoinRuleWithJoinOnUniqueInputWithAlias.json b/tests/calcite/testSemiJoinRuleWithJoinOnUniqueInputWithAlias.json new file mode 100644 index 0000000..2d788dc --- /dev/null +++ b/tests/calcite/testSemiJoinRuleWithJoinOnUniqueInputWithAlias.json @@ -0,0 +1,121 @@ +{ + "help" : [ "LogicalProject(DEPARTMENT_ID=[$1], SALARY=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[inner])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPARTMENT_ID=[$1], SALARY=[$0])\n LogicalJoin(condition=[=($1, $2)], joinType=[semi])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], + "schemas" : [ { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR" ], + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + } ], + "queries" : [ { + "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ] + } + }, + "kind" : "INNER", + "right" : { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + }, { + "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ] + } + }, + "kind" : "SEMI", + "right" : { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testSemiJoinTrim.json b/tests/calcite/testSemiJoinTrim.json index 39482fe..a8eab5d 100644 --- a/tests/calcite/testSemiJoinTrim.json +++ b/tests/calcite/testSemiJoinTrim.json @@ -1,37 +1,33 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7], $f0=[true])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, CUSTOMER, ACCOUNT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalJoin(condition=[=($0, $1)], joinType=[semi])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ACCTNO=[$0])\n LogicalTableScan(table=[[CATALOG, CUSTOMER, ACCOUNT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "ACCOUNT", - "fields" : [ "ACCTNO", "TYPE", "BALANCE" ], "types" : [ "INTEGER", "VARCHAR", "INTEGER" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ ], - "foreign" : [ ] + "nullable" : [ false, false, false ], + "name" : "CATALOG.CUSTOMER.ACCOUNT", + "guaranteed" : [ ], + "fields" : [ "ACCTNO", "TYPE", "BALANCE" ], + "key" : [ ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -39,13 +35,12 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -53,61 +48,62 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 1 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] } } } }, + "kind" : "INNER", "right" : { "scan" : 2 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -115,13 +111,12 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -129,73 +124,78 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } }, + "kind" : "SEMI", "right" : { "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 5, "type" : "INTEGER" }, { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + } ] } } } }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 2 + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 2 - } + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $2)], joinType=[inner])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7], $f0=[true])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, CUSTOMER, ACCOUNT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalJoin(condition=[=($0, $1)], joinType=[semi])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$1])\n LogicalFilter(condition=[>($0, 100)])\n LogicalProject(SAL=[$5], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(ACCTNO=[$0])\n LogicalTableScan(table=[[CATALOG, CUSTOMER, ACCOUNT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSimplifyFilter.json b/tests/calcite/testSimplifyFilter.json index cf539c0..747dbec 100644 --- a/tests/calcite/testSimplifyFilter.json +++ b/tests/calcite/testSimplifyFilter.json @@ -1,114 +1,59 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(>($0, 3), >($7, 5))])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>($0, 3)])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "3", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "3" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "5", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "5" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 @@ -116,12 +61,37 @@ } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -149,9 +119,47 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "3" + } ], + "operator" : ">" + }, + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : ">" + }, + "source" : { + "scan" : 0 + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -179,45 +187,37 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "3", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(>($0, 3), >($7, 5))])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>($0, 3)])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSkipReduceConstantsCaseEquals.json b/tests/calcite/testSkipReduceConstantsCaseEquals.json index 213427c..2962ff9 100644 --- a/tests/calcite/testSkipReduceConstantsCaseEquals.json +++ b/tests/calcite/testSkipReduceConstantsCaseEquals.json @@ -1,14 +1,84 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalFilter(condition=[=(CASE(IS NOT NULL($3), CAST($3):INTEGER NOT NULL, -1), CASE(IS NOT NULL($12), CAST($12):INTEGER NOT NULL, -1))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[=(CASE(IS NOT NULL($3), CAST($3):INTEGER NOT NULL, -1), CASE(IS NOT NULL($12), CAST($12):INTEGER NOT NULL, -1))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "CAST" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "-1" + } ], + "operator" : "CASE" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + } ], + "operator" : "IS NOT NULL" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 12, + "type" : "INTEGER" + } ], + "operator" : "CAST" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "-1" + } ], + "operator" : "CASE" + } ], + "operator" : "=" + }, + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "scan" : 0 + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -63,79 +133,70 @@ }, { "column" : 17, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { - "filter" : { + "join" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 3, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "-1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "-1" } ], - "type" : "INTEGER" + "operator" : "CASE" }, { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 12, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "-1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "-1" } ], - "type" : "INTEGER" + "operator" : "CASE" } ], - "type" : "BOOLEAN" + "operator" : "=" }, - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 0 - } - } + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -190,68 +251,7 @@ }, { "column" : 17, "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "operator" : "CASE", - "operand" : [ { - "operator" : "IS NOT NULL", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "IS NOT NULL", - "operand" : [ { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "-1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 0 - } - } - } + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalFilter(condition=[=(CASE(IS NOT NULL($3), CAST($3):INTEGER NOT NULL, -1), CASE(IS NOT NULL($12), CAST($12):INTEGER NOT NULL, -1))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])\n LogicalJoin(condition=[=(CASE(IS NOT NULL($3), CAST($3):INTEGER NOT NULL, -1), CASE(IS NOT NULL($12), CAST($12):INTEGER NOT NULL, -1))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSome.json b/tests/calcite/testSome.json index 0ba884b..df350d5 100644 --- a/tests/calcite/testSome.json +++ b/tests/calcite/testSome.json @@ -1,78 +1,48 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[> SOME($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(AND(IS TRUE(>($0, $9)), <>($10, 0)), AND(>($10, $11), null, <>($10, 0), IS NOT TRUE(>($0, $9))), AND(>($0, $9), <>($10, 0), IS NOT TRUE(>($0, $9)), <=($10, $11)))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(m=[$0], c=[$1], d=[$1])\n LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], - "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] - }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "> SOME", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "query" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 9, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "> SOME" }, "source" : { - "scan" : 0 + "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -100,47 +70,22 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -148,26 +93,26 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "IS TRUE" }, { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "<>" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" @@ -175,26 +120,26 @@ "column" : 11, "type" : "BIGINT" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "NULL", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "NULL" }, { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "<>" }, { - "operator" : "IS NOT TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -202,15 +147,15 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT TRUE" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -218,22 +163,22 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "<>" }, { - "operator" : "IS NOT TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -241,11 +186,11 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT TRUE" }, { - "operator" : "<=", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" @@ -253,25 +198,57 @@ "column" : 11, "type" : "BIGINT" } ], - "type" : "BOOLEAN" + "operator" : "<=" } ], - "type" : "BOOLEAN" + "operator" : "AND" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { - "scan" : 0 + "scan" : 1 }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -281,75 +258,71 @@ }, { "column" : 1, "type" : "BIGINT" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - } + } ] } } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[> SOME($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(AND(IS TRUE(>($0, $9)), <>($10, 0)), AND(>($10, $11), null, <>($10, 0), IS NOT TRUE(>($0, $9))), AND(>($0, $9), <>($10, 0), IS NOT TRUE(>($0, $9)), <=($10, $11)))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(m=[$0], c=[$1], d=[$1])\n LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSomeWithEquality.json b/tests/calcite/testSomeWithEquality.json index a6b62c3..a87be23 100644 --- a/tests/calcite/testSomeWithEquality.json +++ b/tests/calcite/testSomeWithEquality.json @@ -1,78 +1,48 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IN($7, {\nLogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], - "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] - }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "IN", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "query" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 9, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "IN" }, "source" : { - "scan" : 0 + "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -100,9 +70,42 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 1 + }, + "kind" : "INNER", + "right" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -130,40 +133,37 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IN($7, {\nLogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSomeWithEquality2.json b/tests/calcite/testSomeWithEquality2.json index 69f3bc8..a182d4f 100644 --- a/tests/calcite/testSomeWithEquality2.json +++ b/tests/calcite/testSomeWithEquality2.json @@ -1,78 +1,48 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IN($1, {\nLogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($1, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], - "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] - }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "IN", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], "query" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 10, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + } ], + "operator" : "IN" }, "source" : { - "scan" : 0 + "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -100,9 +70,51 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 9, + "type" : "VARCHAR" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 1 + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] + } + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -130,86 +142,37 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - } - } - } + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IN($1, {\nLogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($1, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0}])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSomeWithNotEquality.json b/tests/calcite/testSomeWithNotEquality.json index 5f6bef7..9707126 100644 --- a/tests/calcite/testSomeWithNotEquality.json +++ b/tests/calcite/testSomeWithNotEquality.json @@ -1,78 +1,48 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[<> SOME($7, {\nLogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(AND(<>($10, $9), <=($10, 1), OR(<>($7, $11), null), <>($9, 0)), AND(=($10, 1), <>($7, $11), <>($9, 0), OR(=($10, $9), >($10, 1))), AND(<>($9, 0), OR(=($10, $9), >($10, 1)), <>($10, 1)))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(c=[$0], d=[$0], m=[$1])\n LogicalAggregate(group=[{}], c=[COUNT()], m=[MAX($0)])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], - "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] - }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<> SOME", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "query" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 9, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "<> SOME" }, "source" : { - "scan" : 0 + "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -100,45 +70,20 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" @@ -146,22 +91,22 @@ "column" : 9, "type" : "BIGINT" } ], - "type" : "BOOLEAN" + "operator" : "<>" }, { - "operator" : "<=", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "<=" }, { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -169,41 +114,41 @@ "column" : 11, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "<>" }, { - "operator" : "NULL", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "NULL" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "<>" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -211,22 +156,22 @@ "column" : 11, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "<>" }, { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "<>" }, { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" @@ -234,39 +179,39 @@ "column" : 9, "type" : "BIGINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "OR" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "<>" }, { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" @@ -274,49 +219,81 @@ "column" : 9, "type" : "BIGINT" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, { - "operator" : "<>", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : "<>" } ], - "type" : "BOOLEAN" + "operator" : "AND" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, "left" : { - "scan" : 0 + "scan" : 1 }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, "target" : [ { "column" : 0, "type" : "BIGINT" @@ -326,75 +303,71 @@ }, { "column" : 1, "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - } + } ] } } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[<> SOME($7, {\nLogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(AND(<>($10, $9), <=($10, 1), OR(<>($7, $11), null), <>($9, 0)), AND(=($10, 1), <>($7, $11), <>($9, 0), OR(=($10, $9), >($10, 1))), AND(<>($9, 0), OR(=($10, $9), >($10, 1)), <>($10, 1)))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(c=[$0], d=[$0], m=[$1])\n LogicalAggregate(group=[{}], c=[COUNT()], m=[MAX($0)])\n LogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSomeWithTwoCorrelatedSubQueries.json b/tests/calcite/testSomeWithTwoCorrelatedSubQueries.json new file mode 100644 index 0000000..ef72a40 --- /dev/null +++ b/tests/calcite/testSomeWithTwoCorrelatedSubQueries.json @@ -0,0 +1,543 @@ +{ + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(> SOME($2, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[AND(=($cor0.ENAME, CAST($1):VARCHAR(20)), >($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n}), < SOME($2, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[AND(=($cor0.ENAME, CAST($1):VARCHAR(20)), <($0, 20))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n}))], variablesSet=[[$cor0]])\n LogicalProject(EMPNO=[$0], ENAME=[$1], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], DEPTNO=[$2])\n LogicalFilter(condition=[OR(CASE(IS NULL($6), false, =($4, 0), false, IS TRUE(>($2, $3)), true, >($4, $5), null:BOOLEAN, >($2, $3)), CASE(IS NULL($10), false, =($8, 0), false, IS TRUE(<($2, $7)), true, >($8, $9), null:BOOLEAN, <($2, $7)))])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{1}])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{1}])\n LogicalProject(EMPNO=[$0], ENAME=[$1], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalProject(m=[$0], c=[$1], d=[$2], trueLiteral=[true])\n LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()], d=[COUNT($0)])\n LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[AND(=($cor0.ENAME, CAST($1):VARCHAR(20)), >($0, 10))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n LogicalProject(m=[$0], c=[$1], d=[$2], trueLiteral=[true])\n LogicalAggregate(group=[{}], m=[MAX($0)], c=[COUNT()], d=[COUNT($0)])\n LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[AND(=($cor0.ENAME, CAST($1):VARCHAR(20)), <($0, 20))])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n" ], + "schemas" : [ { + "types" : [ "INTEGER", "VARCHAR" ], + "nullable" : [ true, true ], + "name" : "CATALOG.SALES.DEPTNULLABLES", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, true, true, true, true, true, true, true, true ], + "name" : "CATALOG.SALES.EMPNULLABLES", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + } ], + "queries" : [ { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "query" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : ">" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ] + } + }, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "> SOME" + }, { + "query" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "<" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ] + } + }, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "< SOME" + } ], + "operator" : "OR" + }, + "source" : { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + }, { + "project" : { + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 6, + "type" : "BOOLEAN" + } ], + "operator" : "IS NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : ">" + } ], + "operator" : "IS TRUE" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "column" : 5, + "type" : "BIGINT" + } ], + "operator" : ">" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : ">" + } ], + "operator" : "CASE" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 10, + "type" : "BOOLEAN" + } ], + "operator" : "IS NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "<" + } ], + "operator" : "IS TRUE" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "column" : 9, + "type" : "BIGINT" + } ], + "operator" : ">" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "<" + } ], + "operator" : "CASE" + } ], + "operator" : "OR" + }, + "source" : { + "correlate" : { + "left" : { + "correlate" : { + "left" : { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 7, + "type" : "INTEGER" + } ] + } + }, + "kind" : "LEFT", + "right" : { + "project" : { + "source" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 4, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : ">" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BIGINT" + }, { + "column" : 5, + "type" : "BIGINT" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] + } + } + } + }, + "kind" : "LEFT", + "right" : { + "project" : { + "source" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 8, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "<" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BIGINT" + }, { + "column" : 9, + "type" : "BIGINT" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] + } + } + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + } ] + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testSomeWithTwoSubQueries.json b/tests/calcite/testSomeWithTwoSubQueries.json new file mode 100644 index 0000000..3a6ec22 --- /dev/null +++ b/tests/calcite/testSomeWithTwoSubQueries.json @@ -0,0 +1,414 @@ +{ + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[OR(> SOME($1, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($1, 'dept1')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n}), < SOME($1, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($1, 'dept2')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n}))])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], DEPTNO=[$1])\n LogicalFilter(condition=[OR(CASE(=($3, 0), false, IS TRUE(>($1, $2)), true, >($3, $4), null:BOOLEAN, >($1, $2)), CASE(=($6, 0), false, IS TRUE(<($1, $5)), true, >($6, $7), null:BOOLEAN, <($1, $5)))])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalJoin(condition=[true], joinType=[inner])\n LogicalProject(EMPNO=[$0], DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])\n LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()], d=[COUNT($0)])\n LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($1, 'dept1')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n LogicalAggregate(group=[{}], m=[MAX($0)], c=[COUNT()], d=[COUNT($0)])\n LogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($1, 'dept2')])\n LogicalTableScan(table=[[CATALOG, SALES, DEPTNULLABLES]])\n" ], + "schemas" : [ { + "types" : [ "INTEGER", "VARCHAR" ], + "nullable" : [ true, true ], + "name" : "CATALOG.SALES.DEPTNULLABLES", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, true, true, true, true, true, true, true, true ], + "name" : "CATALOG.SALES.EMPNULLABLES", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + } ], + "queries" : [ { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "query" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept1'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ] + } + }, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "> SOME" + }, { + "query" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept2'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 2, + "type" : "INTEGER" + } ] + } + }, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "< SOME" + } ], + "operator" : "OR" + }, + "source" : { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ] + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + }, { + "project" : { + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : ">" + } ], + "operator" : "IS TRUE" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "BIGINT" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "operator" : ">" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : ">" + } ], + "operator" : "CASE" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "false" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "<" + } ], + "operator" : "IS TRUE" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "column" : 7, + "type" : "BIGINT" + } ], + "operator" : ">" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "NULL" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "<" + } ], + "operator" : "CASE" + } ], + "operator" : "OR" + }, + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, + "left" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, + "left" : { + "project" : { + "source" : { + "scan" : 1 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ] + } + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept1'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + } + } + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "VARCHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'dept2'" + } ], + "operator" : "=" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + } + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + } ] +} \ No newline at end of file diff --git a/tests/calcite/testSortJoinCopyInnerJoinOrderBy.json b/tests/calcite/testSortJoinCopyInnerJoinOrderBy.json index 31bef90..9635fc5 100644 --- a/tests/calcite/testSortJoinCopyInnerJoinOrderBy.json +++ b/tests/calcite/testSortJoinCopyInnerJoinOrderBy.json @@ -1,21 +1,51 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "sort" : { + "offset" : null, + "limit" : null, + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "scan" : 1 + } + } + }, + "collation" : [ [ 5, "INTEGER", "ASCENDING" ] ] + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -49,15 +79,18 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "sort" : { - "collation" : [ [ 5, "INTEGER", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -65,21 +98,27 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "scan" : 0 + "sort" : { + "offset" : null, + "limit" : null, + "source" : { + "scan" : 0 + }, + "collation" : [ [ 5, "INTEGER", "ASCENDING" ] ] + } }, + "kind" : "INNER", "right" : { "scan" : 1 } } - } + }, + "collation" : [ [ 5, "INTEGER", "ASCENDING" ] ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -113,40 +152,7 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], - "source" : { - "sort" : { - "collation" : [ [ 5, "INTEGER", "ASC" ] ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "sort" : { - "collation" : [ [ 5, "INTEGER", "ASC" ] ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "scan" : 1 - } - } - } - } - } + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSortJoinCopyInnerJoinOrderByLimit.json b/tests/calcite/testSortJoinCopyInnerJoinOrderByLimit.json index 71dcb62..bb5790b 100644 --- a/tests/calcite/testSortJoinCopyInnerJoinOrderByLimit.json +++ b/tests/calcite/testSortJoinCopyInnerJoinOrderByLimit.json @@ -1,68 +1,34 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], "source" : { "sort" : { - "collation" : [ [ 5, "INTEGER", "ASC" ] ], + "offset" : null, "limit" : { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -70,32 +36,31 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "collation" : [ [ 5, "INTEGER", "ASCENDING" ] ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -129,20 +94,22 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "sort" : { - "collation" : [ [ 5, "INTEGER", "ASC" ] ], + "offset" : null, "limit" : { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -150,35 +117,72 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "sort" : { - "collation" : [ [ 5, "INTEGER", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "scan" : 0 - } + }, + "collation" : [ [ 5, "INTEGER", "ASCENDING" ] ] } }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "collation" : [ [ 5, "INTEGER", "ASCENDING" ] ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSortJoinCopyInnerJoinOrderByTwoFields.json b/tests/calcite/testSortJoinCopyInnerJoinOrderByTwoFields.json index 5926929..ad03778 100644 --- a/tests/calcite/testSortJoinCopyInnerJoinOrderByTwoFields.json +++ b/tests/calcite/testSortJoinCopyInnerJoinOrderByTwoFields.json @@ -1,21 +1,51 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], sort1=[$10], dir0=[ASC], dir1=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], sort1=[$10], dir0=[ASC], dir1=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalSort(sort0=[$1], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "sort" : { + "offset" : null, + "limit" : null, + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "scan" : 1 + } + } + }, + "collation" : [ [ 5, "INTEGER", "ASCENDING" ], [ 10, "VARCHAR", "ASCENDING" ] ] + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -49,15 +79,18 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "sort" : { - "collation" : [ [ 5, "INTEGER", "ASC" ], [ 10, "VARCHAR", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -65,21 +98,34 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "scan" : 0 + "sort" : { + "offset" : null, + "limit" : null, + "source" : { + "scan" : 0 + }, + "collation" : [ [ 5, "INTEGER", "ASCENDING" ] ] + } }, + "kind" : "INNER", "right" : { - "scan" : 1 + "sort" : { + "offset" : null, + "limit" : null, + "source" : { + "scan" : 1 + }, + "collation" : [ [ 1, "VARCHAR", "ASCENDING" ] ] + } } } - } + }, + "collation" : [ [ 5, "INTEGER", "ASCENDING" ], [ 10, "VARCHAR", "ASCENDING" ] ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -113,45 +159,7 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], - "source" : { - "sort" : { - "collation" : [ [ 5, "INTEGER", "ASC" ], [ 10, "VARCHAR", "ASC" ] ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "sort" : { - "collation" : [ [ 5, "INTEGER", "ASC" ] ], - "source" : { - "scan" : 0 - } - } - }, - "right" : { - "sort" : { - "collation" : [ [ 1, "VARCHAR", "ASC" ] ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], sort1=[$10], dir0=[ASC], dir1=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], sort1=[$10], dir0=[ASC], dir1=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalSort(sort0=[$5], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalSort(sort0=[$1], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSortJoinCopySemiJoinOrderBy.json b/tests/calcite/testSortJoinCopySemiJoinOrderBy.json index 592d046..d9b0699 100644 --- a/tests/calcite/testSortJoinCopySemiJoinOrderBy.json +++ b/tests/calcite/testSortJoinCopySemiJoinOrderBy.json @@ -1,27 +1,28 @@ { + "help" : [ "LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "sort" : { - "collation" : [ [ 0, "INTEGER", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -29,33 +30,35 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "collation" : [ [ 0, "INTEGER", "ASCENDING" ] ] } }, { "sort" : { - "collation" : [ [ 0, "INTEGER", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -63,30 +66,33 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "sort" : { - "collation" : [ [ 0, "INTEGER", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "scan" : 0 - } + }, + "collation" : [ [ 0, "INTEGER", "ASCENDING" ] ] } }, + "kind" : "SEMI", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "collation" : [ [ 0, "INTEGER", "ASCENDING" ] ] } - } ], - "help" : [ "LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSortJoinCopySemiJoinOrderByLimitOffset.json b/tests/calcite/testSortJoinCopySemiJoinOrderByLimitOffset.json index 4865645..672b72f 100644 --- a/tests/calcite/testSortJoinCopySemiJoinOrderByLimitOffset.json +++ b/tests/calcite/testSortJoinCopySemiJoinOrderByLimitOffset.json @@ -1,37 +1,36 @@ { + "help" : [ "LogicalSort(sort0=[$0], dir0=[ASC], offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalSort(sort0=[$0], dir0=[ASC], offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "sort" : { - "collation" : [ [ 0, "INTEGER", "ASC" ] ], "offset" : { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" }, "limit" : { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -39,43 +38,43 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "collation" : [ [ 0, "INTEGER", "ASCENDING" ] ] } }, { "sort" : { - "collation" : [ [ 0, "INTEGER", "ASC" ] ], "offset" : { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" }, "limit" : { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -83,30 +82,33 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "sort" : { - "collation" : [ [ 0, "INTEGER", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "scan" : 0 - } + }, + "collation" : [ [ 0, "INTEGER", "ASCENDING" ] ] } }, + "kind" : "SEMI", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "collation" : [ [ 0, "INTEGER", "ASCENDING" ] ] } - } ], - "help" : [ "LogicalSort(sort0=[$0], dir0=[ASC], offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalSort(sort0=[$0], dir0=[ASC], offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSortJoinCopySemiJoinOrderByOffset.json b/tests/calcite/testSortJoinCopySemiJoinOrderByOffset.json index 9865bca..a57b0ba 100644 --- a/tests/calcite/testSortJoinCopySemiJoinOrderByOffset.json +++ b/tests/calcite/testSortJoinCopySemiJoinOrderByOffset.json @@ -1,32 +1,32 @@ { + "help" : [ "LogicalSort(sort0=[$0], dir0=[ASC], offset=[2])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalSort(sort0=[$0], dir0=[ASC], offset=[2])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "sort" : { - "collation" : [ [ 0, "INTEGER", "ASC" ] ], "offset" : { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" }, + "limit" : null, "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -34,38 +34,39 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "SEMI", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "collation" : [ [ 0, "INTEGER", "ASCENDING" ] ] } }, { "sort" : { - "collation" : [ [ 0, "INTEGER", "ASC" ] ], "offset" : { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" }, + "limit" : null, "source" : { "join" : { - "kind" : "SEMI", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -73,30 +74,33 @@ "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "sort" : { - "collation" : [ [ 0, "INTEGER", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "scan" : 0 - } + }, + "collation" : [ [ 0, "INTEGER", "ASCENDING" ] ] } }, + "kind" : "SEMI", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "collation" : [ [ 0, "INTEGER", "ASCENDING" ] ] } - } ], - "help" : [ "LogicalSort(sort0=[$0], dir0=[ASC], offset=[2])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalSort(sort0=[$0], dir0=[ASC], offset=[2])\n LogicalJoin(condition=[=($0, $2)], joinType=[semi])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSortJoinTranspose1.json b/tests/calcite/testSortJoinTranspose1.json index d45acb8..b37a3e3 100644 --- a/tests/calcite/testSortJoinTranspose1.json +++ b/tests/calcite/testSortJoinTranspose1.json @@ -1,68 +1,34 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], "source" : { "sort" : { - "collation" : [ [ 5, "INTEGER", "ASC" ] ], + "offset" : null, "limit" : { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -70,32 +36,31 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "collation" : [ [ 5, "INTEGER", "ASCENDING" ] ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -129,20 +94,22 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "sort" : { - "collation" : [ [ 5, "INTEGER", "ASC" ] ], + "offset" : null, "limit" : { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -150,40 +117,76 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "sort" : { - "collation" : [ [ 5, "INTEGER", "ASC" ] ], + "offset" : null, "limit" : { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, "source" : { "scan" : 0 - } + }, + "collation" : [ [ 5, "INTEGER", "ASCENDING" ] ] } }, + "kind" : "LEFT", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "collation" : [ [ 5, "INTEGER", "ASCENDING" ] ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalJoin(condition=[=($7, $9)], joinType=[left])\n LogicalSort(sort0=[$5], dir0=[ASC], fetch=[10])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSortJoinTranspose2.json b/tests/calcite/testSortJoinTranspose2.json index 8cb9162..63d4a2c 100644 --- a/tests/calcite/testSortJoinTranspose2.json +++ b/tests/calcite/testSortJoinTranspose2.json @@ -1,63 +1,30 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalSort(sort0=[$1], dir0=[ASC])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], "source" : { "sort" : { - "collation" : [ [ 10, "VARCHAR", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "join" : { - "kind" : "RIGHT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -65,32 +32,31 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "RIGHT", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "collation" : [ [ 10, "VARCHAR", "ASCENDING" ] ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -124,15 +90,18 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "sort" : { - "collation" : [ [ 10, "VARCHAR", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "join" : { - "kind" : "RIGHT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -140,35 +109,72 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "RIGHT", "right" : { "sort" : { - "collation" : [ [ 1, "VARCHAR", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } + } ] } - } + }, + "collation" : [ [ 1, "VARCHAR", "ASCENDING" ] ] } } } - } + }, + "collation" : [ [ 10, "VARCHAR", "ASCENDING" ] ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalSort(sort0=[$1], dir0=[ASC])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSortJoinTranspose4.json b/tests/calcite/testSortJoinTranspose4.json index 8cb9162..63d4a2c 100644 --- a/tests/calcite/testSortJoinTranspose4.json +++ b/tests/calcite/testSortJoinTranspose4.json @@ -1,63 +1,30 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalSort(sort0=[$1], dir0=[ASC])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - } ], "source" : { "sort" : { - "collation" : [ [ 10, "VARCHAR", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "join" : { - "kind" : "RIGHT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -65,32 +32,31 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "RIGHT", "right" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "collation" : [ [ 10, "VARCHAR", "ASCENDING" ] ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -124,15 +90,18 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "sort" : { - "collation" : [ [ 10, "VARCHAR", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "join" : { - "kind" : "RIGHT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -140,35 +109,72 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "RIGHT", "right" : { "sort" : { - "collation" : [ [ 1, "VARCHAR", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } + } ] } - } + }, + "collation" : [ [ 1, "VARCHAR", "ASCENDING" ] ] } } } - } + }, + "collation" : [ [ 10, "VARCHAR", "ASCENDING" ] ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalSort(sort0=[$10], dir0=[ASC])\n LogicalJoin(condition=[=($7, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalSort(sort0=[$1], dir0=[ASC])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSortJoinTranspose6.json b/tests/calcite/testSortJoinTranspose6.json index 223f659..b306622 100644 --- a/tests/calcite/testSortJoinTranspose6.json +++ b/tests/calcite/testSortJoinTranspose6.json @@ -1,46 +1,38 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], EMPNO=[$2])\n LogicalSort(offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EMPNO=[$2])\n LogicalSort(offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalSort(offset=[2], fetch=[10])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], "source" : { "sort" : { - "collation" : [ ], "offset" : { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" }, "limit" : { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, "source" : { "join" : { - "kind" : "RIGHT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -48,46 +40,46 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "RIGHT", "right" : { "scan" : 1 } } - } + }, + "collation" : [ ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 2, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "sort" : { - "collation" : [ ], "offset" : { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" }, "limit" : { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, "source" : { "join" : { - "kind" : "RIGHT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -95,34 +87,42 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "RIGHT", "right" : { "sort" : { - "collation" : [ ], "offset" : { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" }, "limit" : { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, "source" : { "scan" : 1 - } + }, + "collation" : [ ] } } } - } + }, + "collation" : [ ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], EMPNO=[$2])\n LogicalSort(offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EMPNO=[$2])\n LogicalSort(offset=[2], fetch=[10])\n LogicalJoin(condition=[=($0, $9)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalSort(offset=[2], fetch=[10])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSortProjectTranspose1.json b/tests/calcite/testSortProjectTranspose1.json index e797a6e..5878fb1 100644 --- a/tests/calcite/testSortProjectTranspose1.json +++ b/tests/calcite/testSortProjectTranspose1.json @@ -1,58 +1,76 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalSort(sort0=[$1], dir0=[ASC], offset=[1])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$0])\n LogicalSort(sort0=[$0], dir0=[ASC], offset=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "sort" : { - "collation" : [ [ 1, "INTEGER", "ASC" ] ], - "offset" : { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" + "project" : { + "source" : { + "sort" : { + "offset" : { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, + "limit" : null, + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + }, + "collation" : [ [ 1, "INTEGER", "ASCENDING" ] ] + } }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "sort" : { + "offset" : { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, + "limit" : null, + "source" : { + "scan" : 0 + }, + "collation" : [ [ 0, "INTEGER", "ASCENDING" ] ] + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "sort" : { - "collation" : [ [ 0, "INTEGER", "ASC" ] ], - "offset" : { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } - } ], - "help" : [ "LogicalSort(sort0=[$1], dir0=[ASC], offset=[1])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$0])\n LogicalSort(sort0=[$0], dir0=[ASC], offset=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSortProjectTranspose2.json b/tests/calcite/testSortProjectTranspose2.json index 3b02b77..4161fbc 100644 --- a/tests/calcite/testSortProjectTranspose2.json +++ b/tests/calcite/testSortProjectTranspose2.json @@ -1,66 +1,84 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0])\n LogicalSort(sort0=[$1], dir0=[ASC], offset=[1])\n LogicalProject(DEPTNO=[$0], EXPR$1=[CAST($0):DOUBLE NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0])\n LogicalProject(DEPTNO=[$0], EXPR$1=[CAST($0):DOUBLE NOT NULL])\n LogicalSort(sort0=[$0], dir0=[ASC], offset=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "sort" : { - "collation" : [ [ 1, "DOUBLE", "ASC" ] ], - "offset" : { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" + "project" : { + "source" : { + "sort" : { + "offset" : { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, + "limit" : null, + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "DOUBLE", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "CAST" + } ] + } + }, + "collation" : [ [ 1, "DOUBLE", "ASCENDING" ] ] + } }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "sort" : { + "offset" : { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + }, + "limit" : null, + "source" : { + "scan" : 0 + }, + "collation" : [ [ 0, "INTEGER", "ASCENDING" ] ] + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "CAST", + "type" : "DOUBLE", "operand" : [ { "column" : 0, "type" : "INTEGER" } ], - "type" : "DOUBLE" - } ], - "source" : { - "scan" : 0 - } + "operator" : "CAST" + } ] } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "type" : "DOUBLE" - } ], - "source" : { - "sort" : { - "collation" : [ [ 0, "INTEGER", "ASC" ] ], - "offset" : { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } - } ], - "help" : [ "LogicalSort(sort0=[$1], dir0=[ASC], offset=[1])\n LogicalProject(DEPTNO=[$0], EXPR$1=[CAST($0):DOUBLE NOT NULL])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[CAST($0):DOUBLE NOT NULL])\n LogicalSort(sort0=[$0], dir0=[ASC], offset=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSortRemovalAllKeysConstant.json b/tests/calcite/testSortRemovalAllKeysConstant.json index eaaed08..937e430 100644 --- a/tests/calcite/testSortRemovalAllKeysConstant.json +++ b/tests/calcite/testSortRemovalAllKeysConstant.json @@ -1,265 +1,151 @@ { + "help" : [ "LogicalProject(C=[$0])\n LogicalSort(sort0=[$1], dir0=[DESC-nulls-last])\n LogicalProject(C=[$2], DEPTNO=[$0])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(C=[$0])\n LogicalProject(C=[$2], DEPTNO=[$0])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "sort" : { - "collation" : [ [ 1, "INTEGER", "DESC-nulls-last" ] ], + "project" : { "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "column" : 0, - "type" : "INTEGER" - } ], + "sort" : { + "offset" : null, + "limit" : null, "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "INTEGER" } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], "source" : { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ] } } } + }, + "target" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" } ] } - } + }, + "collation" : [ [ 1, "INTEGER", "DESCENDING" ] ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "BIGINT" + } ] } }, { "project" : { - "target" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "INTEGER" } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], "source" : { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ] } } } + }, + "target" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "BIGINT" + } ] } - } ], - "help" : [ "LogicalSort(sort0=[$1], dir0=[DESC-nulls-last])\n LogicalProject(C=[$2], DEPTNO=[$0])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(C=[$2], DEPTNO=[$0])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSortRemovalOneKeyConstant.json b/tests/calcite/testSortRemovalOneKeyConstant.json index 3ea6b44..3aa8201 100644 --- a/tests/calcite/testSortRemovalOneKeyConstant.json +++ b/tests/calcite/testSortRemovalOneKeyConstant.json @@ -1,276 +1,164 @@ { + "help" : [ "LogicalProject(C=[$0])\n LogicalSort(sort0=[$1], sort1=[$2], dir0=[ASC], dir1=[DESC])\n LogicalProject(C=[$2], DEPTNO=[$0], SAL=[$1])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(C=[$0])\n LogicalSort(sort0=[$2], dir0=[DESC])\n LogicalProject(C=[$2], DEPTNO=[$0], SAL=[$1])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "sort" : { - "collation" : [ [ 1, "INTEGER", "ASC" ], [ 2, "INTEGER", "DESC" ] ], + "project" : { "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], + "sort" : { + "offset" : null, + "limit" : null, "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "INTEGER" } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], "source" : { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ] } } } + }, + "target" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" } ] } - } + }, + "collation" : [ [ 1, "INTEGER", "ASCENDING" ], [ 2, "INTEGER", "DESCENDING" ] ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "BIGINT" + } ] } }, { - "sort" : { - "collation" : [ [ 2, "INTEGER", "DESC" ] ], + "project" : { "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], + "sort" : { + "offset" : null, + "limit" : null, "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "INTEGER" } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], "source" : { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ] } } } + }, + "target" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" } ] } - } + }, + "collation" : [ [ 2, "INTEGER", "DESCENDING" ] ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "BIGINT" + } ] } - } ], - "help" : [ "LogicalSort(sort0=[$1], sort1=[$2], dir0=[ASC], dir1=[DESC])\n LogicalProject(C=[$2], DEPTNO=[$0], SAL=[$1])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalSort(sort0=[$2], dir0=[DESC])\n LogicalProject(C=[$2], DEPTNO=[$0], SAL=[$1])\n LogicalAggregate(group=[{0, 1}], C=[COUNT()])\n LogicalProject(DEPTNO=[$7], SAL=[$5])\n LogicalFilter(condition=[=($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSortUnionTranspose.json b/tests/calcite/testSortUnionTranspose.json index fd14cc9..49a58ce 100644 --- a/tests/calcite/testSortUnionTranspose.json +++ b/tests/calcite/testSortUnionTranspose.json @@ -1,104 +1,108 @@ { + "help" : [ "LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalProject(NAME=[$0])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalUnion(all=[true])\n LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "sort" : { - "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "offset" : null, "limit" : { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { "union" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } } ] - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ] } - } + }, + "collation" : [ [ 0, "VARCHAR", "ASCENDING" ] ] } }, { "sort" : { - "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "offset" : null, "limit" : { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, "source" : { "union" : [ { "sort" : { - "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "offset" : null, "limit" : { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } - } + }, + "collation" : [ [ 0, "VARCHAR", "ASCENDING" ] ] } }, { "sort" : { - "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "offset" : null, "limit" : { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } - } + }, + "collation" : [ [ 0, "VARCHAR", "ASCENDING" ] ] } } ] - } + }, + "collation" : [ [ 0, "VARCHAR", "ASCENDING" ] ] } - } ], - "help" : [ "LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalProject(NAME=[$0])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalUnion(all=[true])\n LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalSort(sort0=[$0], dir0=[ASC], fetch=[10])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSortUnionTranspose2.json b/tests/calcite/testSortUnionTranspose2.json index 17917dc..8e0e98d 100644 --- a/tests/calcite/testSortUnionTranspose2.json +++ b/tests/calcite/testSortUnionTranspose2.json @@ -1,84 +1,92 @@ { + "help" : [ "LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalProject(NAME=[$0])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalUnion(all=[true])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "sort" : { - "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { "union" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } } ] - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ] } - } + }, + "collation" : [ [ 0, "VARCHAR", "ASCENDING" ] ] } }, { "sort" : { - "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "union" : [ { "sort" : { - "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } - } + }, + "collation" : [ [ 0, "VARCHAR", "ASCENDING" ] ] } }, { "sort" : { - "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "offset" : null, + "limit" : null, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } - } + }, + "collation" : [ [ 0, "VARCHAR", "ASCENDING" ] ] } } ] - } + }, + "collation" : [ [ 0, "VARCHAR", "ASCENDING" ] ] } - } ], - "help" : [ "LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalProject(NAME=[$0])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalUnion(all=[true])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalSort(sort0=[$0], dir0=[ASC])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSortUnionTranspose3.json b/tests/calcite/testSortUnionTranspose3.json index bf8ebb8..65a6cdd 100644 --- a/tests/calcite/testSortUnionTranspose3.json +++ b/tests/calcite/testSortUnionTranspose3.json @@ -1,104 +1,108 @@ { + "help" : [ "LogicalSort(sort0=[$0], dir0=[ASC], fetch=[0])\n LogicalProject(NAME=[$0])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalSort(sort0=[$0], dir0=[ASC], fetch=[0])\n LogicalUnion(all=[true])\n LogicalSort(sort0=[$0], dir0=[ASC], fetch=[0])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalSort(sort0=[$0], dir0=[ASC], fetch=[0])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "sort" : { - "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "offset" : null, "limit" : { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" }, "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { "union" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } } ] - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ] } - } + }, + "collation" : [ [ 0, "VARCHAR", "ASCENDING" ] ] } }, { "sort" : { - "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "offset" : null, "limit" : { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" }, "source" : { "union" : [ { "sort" : { - "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "offset" : null, "limit" : { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } - } + }, + "collation" : [ [ 0, "VARCHAR", "ASCENDING" ] ] } }, { "sort" : { - "collation" : [ [ 0, "VARCHAR", "ASC" ] ], + "offset" : null, "limit" : { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } - } + }, + "collation" : [ [ 0, "VARCHAR", "ASCENDING" ] ] } } ] - } + }, + "collation" : [ [ 0, "VARCHAR", "ASCENDING" ] ] } - } ], - "help" : [ "LogicalSort(sort0=[$0], dir0=[ASC], fetch=[0])\n LogicalProject(NAME=[$0])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalSort(sort0=[$0], dir0=[ASC], fetch=[0])\n LogicalUnion(all=[true])\n LogicalSort(sort0=[$0], dir0=[ASC], fetch=[0])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalSort(sort0=[$0], dir0=[ASC], fetch=[0])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSpatialContainsPoint.json b/tests/calcite/testSpatialContainsPoint.json index 9d37ad2..db0110f 100644 --- a/tests/calcite/testSpatialContainsPoint.json +++ b/tests/calcite/testSpatialContainsPoint.json @@ -1,56 +1,41 @@ { + "help" : [ "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_CONTAINS(ST_BUFFER(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), 6), ST_POINT($2, $1))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]), ST_CONTAINS(POLYGON ((16 20, 15.884711682419383 18.829458067903232, 15.54327719506772 17.703899405809462, 14.988817673815271 16.666578601882385, 14.242640687119286 15.757359312880716, 13.333421398117615 15.011182326184729, 12.29610059419054 14.45672280493228, 11.17054193209677 14.115288317580617, 10 14, 8.82945806790323 14.115288317580617, 7.703899405809461 14.45672280493228, 6.666578601882389 15.011182326184727, 5.757359312880715 15.757359312880714, 5.011182326184728 16.666578601882385, 4.45672280493228 17.70389940580946, 4.115288317580617 18.82945806790323, 4 20, 4.115288317580617 21.17054193209677, 4.456722804932279 22.296100594190538, 5.011182326184727 23.33342139811761, 5.757359312880714 24.242640687119284, 6.666578601882387 24.98881767381527, 7.703899405809458 25.54327719506772, 8.829458067903229 25.884711682419383, 9.999999999999998 26, 11.17054193209677 25.884711682419383, 12.29610059419054 25.54327719506772, 13.333421398117611 24.988817673815273, 14.242640687119284 24.242640687119284, 14.988817673815271 23.333421398117615, 15.54327719506772 22.29610059419054, 15.884711682419383 21.17054193209677, 16 20)):GEOMETRY, ST_POINT($2, $1)))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n" ], "schemas" : [ { - "name" : "RESTAURANTS", - "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], "types" : [ "VARCHAR", "INTEGER", "INTEGER", "VARCHAR", "BIGINT" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, false, false ], + "name" : "CATALOG.GEO.RESTAURANTS", + "guaranteed" : [ ], + "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "ST_CONTAINS", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "ST_BUFFER", + "type" : "GEOMETRY", "operand" : [ { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { - "operator" : "10.0", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "10.0" }, { - "operator" : "20.0", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "20.0" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" }, { - "operator" : "6", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "6" } ], - "type" : "GEOMETRY" + "operator" : "ST_BUFFER" }, { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -58,18 +43,15 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" } ], - "type" : "BOOLEAN" + "operator" : "ST_CONTAINS" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -85,30 +67,33 @@ }, { "column" : 4, "type" : "BIGINT" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "SEARCH", + "type" : "BOOLEAN", "operand" : [ { "column" : 4, "type" : "BIGINT" }, { - "operator" : "Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]" } ], - "type" : "BOOLEAN" + "operator" : "SEARCH" }, { - "operator" : "ST_CONTAINS", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "POLYGON ((16 20, 15.884711682419383 18.829458067903232, 15.54327719506772 17.703899405809462, 14.988817673815271 16.666578601882385, 14.242640687119286 15.757359312880716, 13.333421398117615 15.011182326184729, 12.29610059419054 14.45672280493228, 11.17054193209677 14.115288317580617, 10 14, 8.82945806790323 14.115288317580617, 7.703899405809461 14.45672280493228, 6.666578601882389 15.011182326184727, 5.757359312880715 15.757359312880714, 5.011182326184728 16.666578601882385, 4.45672280493228 17.70389940580946, 4.115288317580617 18.82945806790323, 4 20, 4.115288317580617 21.17054193209677, 4.456722804932279 22.296100594190538, 5.011182326184727 23.33342139811761, 5.757359312880714 24.242640687119284, 6.666578601882387 24.98881767381527, 7.703899405809458 25.54327719506772, 8.829458067903229 25.884711682419383, 9.999999999999998 26, 11.17054193209677 25.884711682419383, 12.29610059419054 25.54327719506772, 13.333421398117611 24.988817673815273, 14.242640687119284 24.242640687119284, 14.988817673815271 23.333421398117615, 15.54327719506772 22.29610059419054, 15.884711682419383 21.17054193209677, 16 20))", + "type" : "GEOMETRY", "operand" : [ ], - "type" : "GEOMETRY" + "operator" : "POLYGON ((16 20, 15.884711682419383 18.829458067903232, 15.54327719506772 17.703899405809462, 14.988817673815271 16.666578601882385, 14.242640687119286 15.757359312880716, 13.333421398117615 15.011182326184729, 12.29610059419054 14.45672280493228, 11.17054193209677 14.115288317580617, 10 14, 8.82945806790323 14.115288317580617, 7.703899405809461 14.45672280493228, 6.666578601882389 15.011182326184727, 5.757359312880715 15.757359312880714, 5.011182326184728 16.666578601882385, 4.45672280493228 17.70389940580946, 4.115288317580617 18.82945806790323, 4 20, 4.115288317580617 21.17054193209677, 4.456722804932279 22.296100594190538, 5.011182326184727 23.33342139811761, 5.757359312880714 24.242640687119284, 6.666578601882387 24.98881767381527, 7.703899405809458 25.54327719506772, 8.829458067903229 25.884711682419383, 9.999999999999998 26, 11.17054193209677 25.884711682419383, 12.29610059419054 25.54327719506772, 13.333421398117611 24.988817673815273, 14.242640687119284 24.242640687119284, 14.988817673815271 23.333421398117615, 15.54327719506772 22.29610059419054, 15.884711682419383 21.17054193209677, 16 20))" }, { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -116,18 +101,33 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" } ], - "type" : "BOOLEAN" + "operator" : "ST_CONTAINS" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ] } - } ], - "help" : [ "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_CONTAINS(ST_BUFFER(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), 6), ST_POINT($2, $1))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]), ST_CONTAINS(POLYGON ((16 20, 15.884711682419383 18.829458067903232, 15.54327719506772 17.703899405809462, 14.988817673815271 16.666578601882385, 14.242640687119286 15.757359312880716, 13.333421398117615 15.011182326184729, 12.29610059419054 14.45672280493228, 11.17054193209677 14.115288317580617, 10 14, 8.82945806790323 14.115288317580617, 7.703899405809461 14.45672280493228, 6.666578601882389 15.011182326184727, 5.757359312880715 15.757359312880714, 5.011182326184728 16.666578601882385, 4.45672280493228 17.70389940580946, 4.115288317580617 18.82945806790323, 4 20, 4.115288317580617 21.17054193209677, 4.456722804932279 22.296100594190538, 5.011182326184727 23.33342139811761, 5.757359312880714 24.242640687119284, 6.666578601882387 24.98881767381527, 7.703899405809458 25.54327719506772, 8.829458067903229 25.884711682419383, 9.999999999999998 26, 11.17054193209677 25.884711682419383, 12.29610059419054 25.54327719506772, 13.333421398117611 24.988817673815273, 14.242640687119284 24.242640687119284, 14.988817673815271 23.333421398117615, 15.54327719506772 22.29610059419054, 15.884711682419383 21.17054193209677, 16 20)):GEOMETRY, ST_POINT($2, $1)))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSpatialDWithinLine.json b/tests/calcite/testSpatialDWithinLine.json index 00eb82a..2c09295 100644 --- a/tests/calcite/testSpatialDWithinLine.json +++ b/tests/calcite/testSpatialDWithinLine.json @@ -1,64 +1,49 @@ { + "help" : [ "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_MAKELINE(ST_POINT(8.0:DECIMAL(2, 1), 20.0:DECIMAL(3, 1)), ST_POINT(12.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1))), ST_POINT($2, $1), 4)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[33064..33076], [33092..33100], [33112..33156], [33164..33176], [33236..33240], [36457..36459], [36501..36503], [36505..36507], [36517..36519]]), ST_DWITHIN(LINESTRING (8 20, 12 20):GEOMETRY, ST_POINT($2, $1), 4))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n" ], "schemas" : [ { - "name" : "RESTAURANTS", - "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], "types" : [ "VARCHAR", "INTEGER", "INTEGER", "VARCHAR", "BIGINT" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, false, false ], + "name" : "CATALOG.GEO.RESTAURANTS", + "guaranteed" : [ ], + "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "ST_DWITHIN", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "ST_MAKELINE", + "type" : "GEOMETRY", "operand" : [ { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { - "operator" : "8.0", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "8.0" }, { - "operator" : "20.0", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "20.0" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" }, { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { - "operator" : "12.0", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "12.0" }, { - "operator" : "20.0", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "20.0" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" } ], - "type" : "GEOMETRY" + "operator" : "ST_MAKELINE" }, { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -66,22 +51,19 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" }, { - "operator" : "4", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "4" } ], - "type" : "BOOLEAN" + "operator" : "ST_DWITHIN" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -97,30 +79,33 @@ }, { "column" : 4, "type" : "BIGINT" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "SEARCH", + "type" : "BOOLEAN", "operand" : [ { "column" : 4, "type" : "BIGINT" }, { - "operator" : "Sarg[[33064..33076], [33092..33100], [33112..33156], [33164..33176], [33236..33240], [36457..36459], [36501..36503], [36505..36507], [36517..36519]]", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "Sarg[[33064..33076], [33092..33100], [33112..33156], [33164..33176], [33236..33240], [36457..36459], [36501..36503], [36505..36507], [36517..36519]]" } ], - "type" : "BOOLEAN" + "operator" : "SEARCH" }, { - "operator" : "ST_DWITHIN", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "LINESTRING (8 20, 12 20)", + "type" : "GEOMETRY", "operand" : [ ], - "type" : "GEOMETRY" + "operator" : "LINESTRING (8 20, 12 20)" }, { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -128,22 +113,37 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" }, { - "operator" : "4", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "4" } ], - "type" : "BOOLEAN" + "operator" : "ST_DWITHIN" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ] } - } ], - "help" : [ "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_MAKELINE(ST_POINT(8.0:DECIMAL(2, 1), 20.0:DECIMAL(3, 1)), ST_POINT(12.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1))), ST_POINT($2, $1), 4)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[33064..33076], [33092..33100], [33112..33156], [33164..33176], [33236..33240], [36457..36459], [36501..36503], [36505..36507], [36517..36519]]), ST_DWITHIN(LINESTRING (8 20, 12 20):GEOMETRY, ST_POINT($2, $1), 4))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSpatialDWithinReversed.json b/tests/calcite/testSpatialDWithinReversed.json index 815184d..04d12ed 100644 --- a/tests/calcite/testSpatialDWithinReversed.json +++ b/tests/calcite/testSpatialDWithinReversed.json @@ -1,36 +1,21 @@ { + "help" : [ "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT($2, $1), ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), 6)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]), ST_DWITHIN(ST_POINT($2, $1), POINT (10 20):GEOMETRY, 6))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n" ], "schemas" : [ { - "name" : "RESTAURANTS", - "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], "types" : [ "VARCHAR", "INTEGER", "INTEGER", "VARCHAR", "BIGINT" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, false, false ], + "name" : "CATALOG.GEO.RESTAURANTS", + "guaranteed" : [ ], + "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "ST_DWITHIN", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -38,34 +23,31 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" }, { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { - "operator" : "10.0", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "10.0" }, { - "operator" : "20.0", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "20.0" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" }, { - "operator" : "6", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "6" } ], - "type" : "BOOLEAN" + "operator" : "ST_DWITHIN" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -81,26 +63,29 @@ }, { "column" : 4, "type" : "BIGINT" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "SEARCH", + "type" : "BOOLEAN", "operand" : [ { "column" : 4, "type" : "BIGINT" }, { - "operator" : "Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]" } ], - "type" : "BOOLEAN" + "operator" : "SEARCH" }, { - "operator" : "ST_DWITHIN", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -108,26 +93,41 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" }, { - "operator" : "POINT (10 20)", + "type" : "GEOMETRY", "operand" : [ ], - "type" : "GEOMETRY" + "operator" : "POINT (10 20)" }, { - "operator" : "6", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "6" } ], - "type" : "BOOLEAN" + "operator" : "ST_DWITHIN" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ] } - } ], - "help" : [ "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT($2, $1), ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), 6)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[33033..33035], [33050..33053], [33055..33080], [33092..33100], [33112..33156], [33164..33176], [33236..33244], [33252..33254], [36456..36464], [36496..36520]]), ST_DWITHIN(ST_POINT($2, $1), POINT (10 20):GEOMETRY, 6))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSpatialDWithinToHilbert.json b/tests/calcite/testSpatialDWithinToHilbert.json index fab21f6..fb7ac49 100644 --- a/tests/calcite/testSpatialDWithinToHilbert.json +++ b/tests/calcite/testSpatialDWithinToHilbert.json @@ -1,48 +1,33 @@ { + "help" : [ "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), ST_POINT($2, $1), 10)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[28988..28989], [28991..28994], [29006..29009], [29011..29014], [32426..32429], [32431..32434], [32446..32449], [32451..32454], [32506..32509], [32511..32514], [32526..32527], [32929..32930], [32942..32949], [32951..32953], [32955..32970], [32973..32975], [33009..33011], [33014..33185], [33187..33190], [33205..33207], [33209..33211], [33226..33229], [33231..33265], [33267..33270], [36392..36401], [36403..36404], [36421..36423], [36425..36427], [36442..36445], [36447..36548], [36556..36568]]), ST_DWITHIN(POINT (10 20):GEOMETRY, ST_POINT($2, $1), 10))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n" ], "schemas" : [ { - "name" : "RESTAURANTS", - "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], "types" : [ "VARCHAR", "INTEGER", "INTEGER", "VARCHAR", "BIGINT" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, false, false ], + "name" : "CATALOG.GEO.RESTAURANTS", + "guaranteed" : [ ], + "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "ST_DWITHIN", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { - "operator" : "10.0", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "10.0" }, { - "operator" : "20.0", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "20.0" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" }, { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -50,22 +35,19 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "ST_DWITHIN" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -81,30 +63,33 @@ }, { "column" : 4, "type" : "BIGINT" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "SEARCH", + "type" : "BOOLEAN", "operand" : [ { "column" : 4, "type" : "BIGINT" }, { - "operator" : "Sarg[[28988..28989], [28991..28994], [29006..29009], [29011..29014], [32426..32429], [32431..32434], [32446..32449], [32451..32454], [32506..32509], [32511..32514], [32526..32527], [32929..32930], [32942..32949], [32951..32953], [32955..32970], [32973..32975], [33009..33011], [33014..33185], [33187..33190], [33205..33207], [33209..33211], [33226..33229], [33231..33265], [33267..33270], [36392..36401], [36403..36404], [36421..36423], [36425..36427], [36442..36445], [36447..36548], [36556..36568]]", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "Sarg[[28988..28989], [28991..28994], [29006..29009], [29011..29014], [32426..32429], [32431..32434], [32446..32449], [32451..32454], [32506..32509], [32511..32514], [32526..32527], [32929..32930], [32942..32949], [32951..32953], [32955..32970], [32973..32975], [33009..33011], [33014..33185], [33187..33190], [33205..33207], [33209..33211], [33226..33229], [33231..33265], [33267..33270], [36392..36401], [36403..36404], [36421..36423], [36425..36427], [36442..36445], [36447..36548], [36556..36568]]" } ], - "type" : "BOOLEAN" + "operator" : "SEARCH" }, { - "operator" : "ST_DWITHIN", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "POINT (10 20)", + "type" : "GEOMETRY", "operand" : [ ], - "type" : "GEOMETRY" + "operator" : "POINT (10 20)" }, { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -112,22 +97,37 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : "ST_DWITHIN" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ] } - } ], - "help" : [ "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), ST_POINT($2, $1), 10)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(SEARCH($4, Sarg[[28988..28989], [28991..28994], [29006..29009], [29011..29014], [32426..32429], [32431..32434], [32446..32449], [32451..32454], [32506..32509], [32511..32514], [32526..32527], [32929..32930], [32942..32949], [32951..32953], [32955..32970], [32973..32975], [33009..33011], [33014..33185], [33187..33190], [33205..33207], [33209..33211], [33226..33229], [33231..33265], [33267..33270], [36392..36401], [36403..36404], [36421..36423], [36425..36427], [36442..36445], [36447..36548], [36556..36568]]), ST_DWITHIN(POINT (10 20):GEOMETRY, ST_POINT($2, $1), 10))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSpatialDWithinToHilbertNegative.json b/tests/calcite/testSpatialDWithinToHilbertNegative.json index bdd57a6..135e4e6 100644 --- a/tests/calcite/testSpatialDWithinToHilbertNegative.json +++ b/tests/calcite/testSpatialDWithinToHilbertNegative.json @@ -1,48 +1,33 @@ { + "help" : [ "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), ST_POINT($2, $1), -2)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalValues(tuples=[[]])\n" ], "schemas" : [ { - "name" : "RESTAURANTS", - "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], "types" : [ "VARCHAR", "INTEGER", "INTEGER", "VARCHAR", "BIGINT" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, false, false ], + "name" : "CATALOG.GEO.RESTAURANTS", + "guaranteed" : [ ], + "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "ST_DWITHIN", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { - "operator" : "10.0", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "10.0" }, { - "operator" : "20.0", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "20.0" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" }, { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -50,22 +35,19 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" }, { - "operator" : "-2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "-2" } ], - "type" : "BOOLEAN" + "operator" : "ST_DWITHIN" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -81,14 +63,32 @@ }, { "column" : 4, "type" : "BIGINT" - } ], + } ] + } + }, { + "project" : { "source" : { "values" : { "schema" : [ "VARCHAR", "INTEGER", "INTEGER", "VARCHAR", "BIGINT" ], "content" : [ ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ] } - } ], - "help" : [ "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), ST_POINT($2, $1), -2)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalValues(tuples=[[]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSpatialDWithinToHilbertZero.json b/tests/calcite/testSpatialDWithinToHilbertZero.json index 3f83d8d..7217983 100644 --- a/tests/calcite/testSpatialDWithinToHilbertZero.json +++ b/tests/calcite/testSpatialDWithinToHilbertZero.json @@ -1,48 +1,33 @@ { + "help" : [ "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), ST_POINT($2, $1), 0)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(=($4, 33139), =(POINT (10 20), ST_POINT($2, $1)))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n" ], "schemas" : [ { - "name" : "RESTAURANTS", - "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], "types" : [ "VARCHAR", "INTEGER", "INTEGER", "VARCHAR", "BIGINT" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, false, false ], + "name" : "CATALOG.GEO.RESTAURANTS", + "guaranteed" : [ ], + "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "ST_DWITHIN", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { - "operator" : "10.0", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "10.0" }, { - "operator" : "20.0", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "20.0" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" }, { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -50,22 +35,19 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "ST_DWITHIN" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" @@ -81,30 +63,33 @@ }, { "column" : 4, "type" : "BIGINT" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 4, "type" : "BIGINT" }, { - "operator" : "33139", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "33139" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "POINT (10 20)", + "type" : "GEOMETRY", "operand" : [ ], - "type" : "GEOMETRY" + "operator" : "POINT (10 20)" }, { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -112,18 +97,33 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "BIGINT" + } ] } - } ], - "help" : [ "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[ST_DWITHIN(ST_POINT(10.0:DECIMAL(3, 1), 20.0:DECIMAL(3, 1)), ST_POINT($2, $1), 0)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(NAME=[$0], LATITUDE=[$1], LONGITUDE=[$2], CUISINE=[$3], HILBERT=[$4])\n LogicalFilter(condition=[AND(=($4, 33139), =(POINT (10 20), ST_POINT($2, $1)))])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSpatialReduce.json b/tests/calcite/testSpatialReduce.json index 72ed1c4..b8c4764 100644 --- a/tests/calcite/testSpatialReduce.json +++ b/tests/calcite/testSpatialReduce.json @@ -1,58 +1,58 @@ { + "help" : [ "LogicalProject(B=[ST_BUFFER(ST_POINT(0.0:DECIMAL(2, 1), 0.0:DECIMAL(2, 1)), 1, 4)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(B=[CAST(POLYGON ((1 0, 0.9238795325112867 -0.3826834323650898, 0.7071067811865476 -0.7071067811865475, 0.3826834323650898 -0.9238795325112867, 0.0000000000000001 -1, -0.3826834323650897 -0.9238795325112867, -0.7071067811865475 -0.7071067811865476, -0.9238795325112867 -0.3826834323650899, -1 -0.0000000000000001, -0.9238795325112868 0.3826834323650897, -0.7071067811865477 0.7071067811865475, -0.3826834323650903 0.9238795325112865, -0.0000000000000002 1, 0.38268343236509 0.9238795325112866, 0.7071067811865474 0.7071067811865477, 0.9238795325112865 0.3826834323650904, 1 0)):GEOMETRY):GEOMETRY])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n" ], "schemas" : [ { - "name" : "RESTAURANTS", - "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], "types" : [ "VARCHAR", "INTEGER", "INTEGER", "VARCHAR", "BIGINT" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, false, false ], + "name" : "CATALOG.GEO.RESTAURANTS", + "guaranteed" : [ ], + "fields" : [ "NAME", "LATITUDE", "LONGITUDE", "CUISINE", "HILBERT" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "ST_BUFFER", + "type" : "GEOMETRY", "operand" : [ { - "operator" : "ST_POINT", + "type" : "GEOMETRY", "operand" : [ { - "operator" : "0.0", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "0.0" }, { - "operator" : "0.0", + "type" : "DECIMAL", "operand" : [ ], - "type" : "DECIMAL" + "operator" : "0.0" } ], - "type" : "GEOMETRY" + "operator" : "ST_POINT" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" }, { - "operator" : "4", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "4" } ], - "type" : "GEOMETRY" - } ], - "source" : { - "scan" : 0 - } + "operator" : "ST_BUFFER" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "operator" : "CAST", + "type" : "GEOMETRY", "operand" : [ { - "operator" : "POLYGON ((1 0, 0.9238795325112867 -0.3826834323650898, 0.7071067811865476 -0.7071067811865475, 0.3826834323650898 -0.9238795325112867, 0.0000000000000001 -1, -0.3826834323650897 -0.9238795325112867, -0.7071067811865475 -0.7071067811865476, -0.9238795325112867 -0.3826834323650899, -1 -0.0000000000000001, -0.9238795325112868 0.3826834323650897, -0.7071067811865477 0.7071067811865475, -0.3826834323650903 0.9238795325112865, -0.0000000000000002 1, 0.38268343236509 0.9238795325112866, 0.7071067811865474 0.7071067811865477, 0.9238795325112865 0.3826834323650904, 1 0))", + "type" : "GEOMETRY", "operand" : [ ], - "type" : "GEOMETRY" + "operator" : "POLYGON ((1 0, 0.9238795325112867 -0.3826834323650898, 0.7071067811865476 -0.7071067811865475, 0.3826834323650898 -0.9238795325112867, 0.0000000000000001 -1, -0.3826834323650897 -0.9238795325112867, -0.7071067811865475 -0.7071067811865476, -0.9238795325112867 -0.3826834323650899, -1 -0.0000000000000001, -0.9238795325112868 0.3826834323650897, -0.7071067811865477 0.7071067811865475, -0.3826834323650903 0.9238795325112865, -0.0000000000000002 1, 0.38268343236509 0.9238795325112866, 0.7071067811865474 0.7071067811865477, 0.9238795325112865 0.3826834323650904, 1 0))" } ], - "type" : "GEOMETRY" - } ], - "source" : { - "scan" : 0 - } + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalProject(B=[ST_BUFFER(ST_POINT(0.0:DECIMAL(2, 1), 0.0:DECIMAL(2, 1)), 1, 4)])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n", "LogicalProject(B=[CAST(POLYGON ((1 0, 0.9238795325112867 -0.3826834323650898, 0.7071067811865476 -0.7071067811865475, 0.3826834323650898 -0.9238795325112867, 0.0000000000000001 -1, -0.3826834323650897 -0.9238795325112867, -0.7071067811865475 -0.7071067811865476, -0.9238795325112867 -0.3826834323650899, -1 -0.0000000000000001, -0.9238795325112868 0.3826834323650897, -0.7071067811865477 0.7071067811865475, -0.3826834323650903 0.9238795325112865, -0.0000000000000002 1, 0.38268343236509 0.9238795325112866, 0.7071067811865474 0.7071067811865477, 0.9238795325112865 0.3826834323650904, 1 0)):GEOMETRY):GEOMETRY])\n LogicalTableScan(table=[[CATALOG, GEO, RESTAURANTS]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testStrengthenJoinType.json b/tests/calcite/testStrengthenJoinType.json index 003b241..18f5aad 100644 --- a/tests/calcite/testStrengthenJoinType.json +++ b/tests/calcite/testStrengthenJoinType.json @@ -1,85 +1,51 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalFilter(condition=[AND(IS NOT NULL($9), >($7, 100))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[CAST($2):INTEGER], ENAME=[CAST($3):VARCHAR(20)], JOB=[CAST($4):VARCHAR(10)], MGR=[$5], HIREDATE=[CAST($6):TIMESTAMP(0)], SAL=[CAST($7):INTEGER], COMM=[CAST($8):INTEGER], DEPTNO0=[CAST($9):INTEGER], SLACKER=[CAST($10):BOOLEAN])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "TIMESTAMP" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "100", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "100" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -87,21 +53,19 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "scan" : 1 } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -135,9 +99,50 @@ }, { "column" : 10, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "100" + } ], + "operator" : ">" + }, + "source" : { + "scan" : 1 + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -145,106 +150,101 @@ "column" : 1, "type" : "VARCHAR" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "VARCHAR", "operand" : [ { "column" : 3, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "VARCHAR", "operand" : [ { "column" : 4, "type" : "VARCHAR" } ], - "type" : "VARCHAR" + "operator" : "CAST" }, { "column" : 5, "type" : "INTEGER" }, { - "operator" : "CAST", + "type" : "TIMESTAMP", "operand" : [ { "column" : 6, "type" : "TIMESTAMP" } ], - "type" : "TIMESTAMP" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 7, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 8, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { "column" : 9, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "CAST" }, { - "operator" : "CAST", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "100", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 1 - } - } - } - } - } + "operator" : "CAST" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "TIMESTAMP" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalFilter(condition=[AND(IS NOT NULL($9), >($7, 100))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[$2], ENAME=[$3], JOB=[$4], MGR=[$5], HIREDATE=[$6], SAL=[$7], COMM=[$8], DEPTNO0=[$9], SLACKER=[$10])\n LogicalProject(DEPTNO=[$0], NAME=[$1], EMPNO=[CAST($2):INTEGER], ENAME=[CAST($3):VARCHAR(20)], JOB=[CAST($4):VARCHAR(10)], MGR=[$5], HIREDATE=[CAST($6):TIMESTAMP(0)], SAL=[CAST($7):INTEGER], COMM=[CAST($8):INTEGER], DEPTNO0=[CAST($9):INTEGER], SLACKER=[CAST($10):BOOLEAN])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalFilter(condition=[>($5, 100)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSumAndDistinctSumWithExpandSumType.json b/tests/calcite/testSumAndDistinctSumWithExpandSumType.json index 30a5b02..5ba1536 100644 --- a/tests/calcite/testSumAndDistinctSumWithExpandSumType.json +++ b/tests/calcite/testSumAndDistinctSumWithExpandSumType.json @@ -1,259 +1,113 @@ { + "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[SUM(DISTINCT $0)])\n LogicalProject(COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[CAST($0):BIGINT], EXPR$1=[$1])\n LogicalAggregate(group=[{}], EXPR$0=[SUM($1)], EXPR$1=[SUM($0)])\n LogicalAggregate(group=[{0}], EXPR$0=[SUM($0)])\n LogicalProject(COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ ], "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + "scan" : 0 + }, + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ] } - }, { - "aggregate" : { + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ ], "function" : [ { - "operator" : "SUM", + "distinct" : false, + "type" : "DECIMAL", "operand" : [ { - "column" : 0, - "type" : "INTEGER" + "column" : 1, + "type" : "BIGINT" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", "operand" : [ { "column" : 0, "type" : "INTEGER" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "SUM", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 6, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } } } } - } ] - } - }, { - "project" : { + }, "target" : [ { - "operator" : "CAST", + "type" : "BIGINT", "operand" : [ { "column" : 0, "type" : "DECIMAL" } ], - "type" : "BIGINT" + "operator" : "CAST" }, { "column" : 1, "type" : "BIGINT" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 1, - "type" : "BIGINT" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "DECIMAL" - }, { - "operator" : "SUM", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } ] - } - } + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{}], EXPR$0=[SUM($0)], EXPR$1=[SUM(DISTINCT $0)])\n LogicalProject(COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[CAST($0):BIGINT], EXPR$1=[$1])\n LogicalAggregate(group=[{}], EXPR$0=[SUM($1)], EXPR$1=[SUM($0)])\n LogicalAggregate(group=[{0}], EXPR$0=[SUM($0)])\n LogicalProject(COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testSwapOuterJoin.json b/tests/calcite/testSwapOuterJoin.json index be2f196..96e6f5f 100644 --- a/tests/calcite/testSwapOuterJoin.json +++ b/tests/calcite/testSwapOuterJoin.json @@ -1,31 +1,26 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalProject(DEPTNO=[$9], NAME=[$10], EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO0=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($9, $7)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -33,26 +28,49 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "scan" : 1 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "project" : { + "source" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 1 + }, + "kind" : "RIGHT", + "right" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 9, "type" : "INTEGER" @@ -86,32 +104,14 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "join" : { - "kind" : "RIGHT", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 1 - }, - "right" : { - "scan" : 0 - } - } - } + } ] } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalProject(DEPTNO=[$9], NAME=[$10], EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO0=[$7], SLACKER=[$8])\n LogicalJoin(condition=[=($9, $7)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceAggregate.json b/tests/calcite/testTransitiveInferenceAggregate.json index a1372a9..33cb83f 100644 --- a/tests/calcite/testTransitiveInferenceAggregate.json +++ b/tests/calcite/testTransitiveInferenceAggregate.json @@ -1,24 +1,19 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -26,121 +21,68 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "7", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "7", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } - } ] + } } }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -148,116 +90,64 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "7", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "7", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } - } ] + } } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 @@ -265,8 +155,12 @@ } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceComplexPredicate.json b/tests/calcite/testTransitiveInferenceComplexPredicate.json index 6679dc7..6a60a5c 100644 --- a/tests/calcite/testTransitiveInferenceComplexPredicate.json +++ b/tests/calcite/testTransitiveInferenceComplexPredicate.json @@ -1,24 +1,19 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[AND(>($7, 7), =($6, $7), >(+($6, $7), /($6, 2)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($5, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[AND(>($7, 7), =($6, $7), >(+($6, $7), /($6, 2)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalFilter(condition=[=($5, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -26,25 +21,25 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 6, "type" : "INTEGER" @@ -52,11 +47,11 @@ "column" : 7, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 6, "type" : "INTEGER" @@ -64,32 +59,33 @@ "column" : 7, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "+" }, { - "operator" : "/", + "type" : "INTEGER", "operand" : [ { "column" : 6, "type" : "INTEGER" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "INTEGER" + "operator" : "/" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" @@ -97,7 +93,7 @@ "column" : 7, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 @@ -105,20 +101,19 @@ } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -126,25 +121,25 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 6, "type" : "INTEGER" @@ -152,11 +147,11 @@ "column" : 7, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 6, "type" : "INTEGER" @@ -164,46 +159,47 @@ "column" : 7, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "+" }, { - "operator" : "/", + "type" : "INTEGER", "operand" : [ { "column" : 6, "type" : "INTEGER" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "INTEGER" + "operator" : "/" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" @@ -211,7 +207,7 @@ "column" : 7, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 @@ -221,8 +217,12 @@ } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[AND(>($7, 7), =($6, $7), >(+($6, $7), /($6, 2)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[=($5, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[AND(>($7, 7), =($6, $7), >(+($6, $7), /($6, 2)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalFilter(condition=[=($5, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceConjunctInPullUp.json b/tests/calcite/testTransitiveInferenceConjunctInPullUp.json index 4c40b71..a281769 100644 --- a/tests/calcite/testTransitiveInferenceConjunctInPullUp.json +++ b/tests/calcite/testTransitiveInferenceConjunctInPullUp.json @@ -1,24 +1,19 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[SEARCH($7, Sarg[7, 9, (10..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[SEARCH($7, Sarg[7, 9, (10..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[SEARCH($7, Sarg[7, 9, (10..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -26,45 +21,45 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : "SEARCH", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "Sarg[7, 9, (10..+∞)]", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "Sarg[7, 9, (10..+∞)]" } ], - "type" : "BOOLEAN" + "operator" : "SEARCH" }, "source" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -72,40 +67,41 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : "SEARCH", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "Sarg[7, 9, (10..+∞)]", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "Sarg[7, 9, (10..+∞)]" } ], - "type" : "BOOLEAN" + "operator" : "SEARCH" }, "source" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : "SEARCH", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "Sarg[7, 9, (10..+∞)]", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "Sarg[7, 9, (10..+∞)]" } ], - "type" : "BOOLEAN" + "operator" : "SEARCH" }, "source" : { "scan" : 0 @@ -113,8 +109,12 @@ } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[SEARCH($7, Sarg[7, 9, (10..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[SEARCH($7, Sarg[7, 9, (10..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[SEARCH($7, Sarg[7, 9, (10..+∞)])])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceJoin.json b/tests/calcite/testTransitiveInferenceJoin.json index 0fed653..972f1ef 100644 --- a/tests/calcite/testTransitiveInferenceJoin.json +++ b/tests/calcite/testTransitiveInferenceJoin.json @@ -1,24 +1,19 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -26,24 +21,25 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 @@ -51,20 +47,19 @@ } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -72,40 +67,41 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 @@ -113,8 +109,12 @@ } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceJoin3way.json b/tests/calcite/testTransitiveInferenceJoin3way.json index 4c72605..4a93970 100644 --- a/tests/calcite/testTransitiveInferenceJoin3way.json +++ b/tests/calcite/testTransitiveInferenceJoin3way.json @@ -1,24 +1,19 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($16, $25)], joinType=[inner])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($16, $25)], joinType=[inner])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 16, "type" : "INTEGER" @@ -26,13 +21,12 @@ "column" : 25, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -40,50 +34,51 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 16, "type" : "INTEGER" @@ -91,13 +86,12 @@ "column" : 25, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -105,40 +99,41 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 @@ -147,19 +142,20 @@ } } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 @@ -167,8 +163,12 @@ } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($16, $25)], joinType=[inner])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($16, $25)], joinType=[inner])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceJoin3wayAgg.json b/tests/calcite/testTransitiveInferenceJoin3wayAgg.json index 27523d0..056558f 100644 --- a/tests/calcite/testTransitiveInferenceJoin3wayAgg.json +++ b/tests/calcite/testTransitiveInferenceJoin3wayAgg.json @@ -1,24 +1,19 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($9, $18)], joinType=[inner])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($9, $18)], joinType=[inner])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" @@ -26,13 +21,12 @@ "column" : 18, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -40,126 +34,74 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "7", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "7", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } - } ] + } } }, + "kind" : "INNER", "right" : { "scan" : 0 } } }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "INTEGER" @@ -167,13 +109,12 @@ "column" : 18, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -181,116 +122,64 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "7", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "7", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } - } ] + } } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 @@ -299,19 +188,20 @@ } } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 @@ -319,8 +209,12 @@ } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($9, $18)], joinType=[inner])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($9, $18)], joinType=[inner])\n LogicalJoin(condition=[=($0, $9)], joinType=[inner])\n LogicalAggregate(group=[{0}], EXPR$1=[COUNT()])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceLeftOuterJoin.json b/tests/calcite/testTransitiveInferenceLeftOuterJoin.json index 25cdfad..44c709e 100644 --- a/tests/calcite/testTransitiveInferenceLeftOuterJoin.json +++ b/tests/calcite/testTransitiveInferenceLeftOuterJoin.json @@ -1,38 +1,33 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($16, 9)])\n LogicalJoin(condition=[=($7, $16)], joinType=[left])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($16, 9)])\n LogicalJoin(condition=[=($7, $16)], joinType=[left])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 16, "type" : "INTEGER" }, { - "operator" : "9", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "9" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -40,61 +35,61 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } }, + "kind" : "LEFT", "right" : { "scan" : 0 } } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 16, "type" : "INTEGER" }, { - "operator" : "9", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "9" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -102,40 +97,41 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } }, + "kind" : "LEFT", "right" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 @@ -145,8 +141,12 @@ } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($16, 9)])\n LogicalJoin(condition=[=($7, $16)], joinType=[left])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($16, 9)])\n LogicalJoin(condition=[=($7, $16)], joinType=[left])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceProject.json b/tests/calcite/testTransitiveInferenceProject.json index 78b1a53..0b6f6e7 100644 --- a/tests/calcite/testTransitiveInferenceProject.json +++ b/tests/calcite/testTransitiveInferenceProject.json @@ -1,24 +1,19 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -26,10 +21,29 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "7" + } ], + "operator" : ">" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -57,46 +71,27 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "7", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -104,10 +99,29 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "7" + } ], + "operator" : ">" + }, + "source" : { + "scan" : 0 + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -135,41 +149,23 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "7", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } + } ] } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 @@ -177,8 +173,12 @@ } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($7, $16)], joinType=[inner])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferencePullUpThruAlias.json b/tests/calcite/testTransitiveInferencePullUpThruAlias.json index 64e1ce8..8bf9de9 100644 --- a/tests/calcite/testTransitiveInferencePullUpThruAlias.json +++ b/tests/calcite/testTransitiveInferencePullUpThruAlias.json @@ -1,24 +1,19 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $8)], joinType=[inner])\n LogicalProject(DEPTNO=[$6])\n LogicalFilter(condition=[>($6, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $8)], joinType=[inner])\n LogicalProject(DEPTNO=[$6])\n LogicalFilter(condition=[>($6, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -26,53 +21,53 @@ "column" : 8, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 6, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ] } }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -80,48 +75,49 @@ "column" : 8, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { - "target" : [ { - "column" : 6, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 6, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 6, + "type" : "INTEGER" + } ] } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 @@ -129,8 +125,12 @@ } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $8)], joinType=[inner])\n LogicalProject(DEPTNO=[$6])\n LogicalFilter(condition=[>($6, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $8)], joinType=[inner])\n LogicalProject(DEPTNO=[$6])\n LogicalFilter(condition=[>($6, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceRightOuterJoin.json b/tests/calcite/testTransitiveInferenceRightOuterJoin.json index 7574181..23bb042 100644 --- a/tests/calcite/testTransitiveInferenceRightOuterJoin.json +++ b/tests/calcite/testTransitiveInferenceRightOuterJoin.json @@ -1,38 +1,33 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($7, 7)])\n LogicalJoin(condition=[=($7, $16)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 9)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($7, 7)])\n LogicalJoin(condition=[=($7, $16)], joinType=[right])\n LogicalFilter(condition=[>($7, 9)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 9)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "join" : { - "kind" : "RIGHT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -40,24 +35,25 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "RIGHT", "right" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "9", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "9" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 @@ -67,34 +63,33 @@ } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "join" : { - "kind" : "RIGHT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -102,40 +97,41 @@ "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "9", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "9" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } }, + "kind" : "RIGHT", "right" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "9", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "9" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 @@ -145,8 +141,12 @@ } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($7, 7)])\n LogicalJoin(condition=[=($7, $16)], joinType=[right])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 9)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalFilter(condition=[>($7, 7)])\n LogicalJoin(condition=[=($7, $16)], joinType=[right])\n LogicalFilter(condition=[>($7, 9)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 9)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceUnion.json b/tests/calcite/testTransitiveInferenceUnion.json index 86ae594..a36c284 100644 --- a/tests/calcite/testTransitiveInferenceUnion.json +++ b/tests/calcite/testTransitiveInferenceUnion.json @@ -1,24 +1,19 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $8)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $8)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -26,81 +21,81 @@ "column" : 8, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "union" : [ { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } } ] }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -108,76 +103,77 @@ "column" : 8, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "union" : [ { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } } ] }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 @@ -185,8 +181,12 @@ } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $8)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $8)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceUnion3way.json b/tests/calcite/testTransitiveInferenceUnion3way.json index e898147..5d25222 100644 --- a/tests/calcite/testTransitiveInferenceUnion3way.json +++ b/tests/calcite/testTransitiveInferenceUnion3way.json @@ -1,24 +1,19 @@ { + "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $8)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $8)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -26,109 +21,109 @@ "column" : 8, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "union" : [ { "union" : [ { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } } ] }, { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } } ] }, + "kind" : "INNER", "right" : { "scan" : 0 } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } }, { "project" : { - "target" : [ { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -136,104 +131,105 @@ "column" : 8, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "union" : [ { "union" : [ { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } } ] }, { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } } ] }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 @@ -241,8 +237,12 @@ } } } - } + }, + "target" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ] } - } ], - "help" : [ "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $8)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EXPR$0=[1])\n LogicalJoin(condition=[=($0, $8)], joinType=[inner])\n LogicalUnion(all=[true])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[>($7, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testTransitiveInferenceUnionAlwaysTrue.json b/tests/calcite/testTransitiveInferenceUnionAlwaysTrue.json index 46a281b..58d8efd 100644 --- a/tests/calcite/testTransitiveInferenceUnionAlwaysTrue.json +++ b/tests/calcite/testTransitiveInferenceUnionAlwaysTrue.json @@ -1,26 +1,19 @@ { + "help" : [ "LogicalProject(DEPTNO=[$0], DEPTNO0=[$1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($7, 4)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], DEPTNO0=[$1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($7, 4)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[<($0, 4)])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -28,91 +21,91 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "4", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "4" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } }, + "kind" : "INNER", "right" : { "union" : [ { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } ] } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -120,93 +113,100 @@ "column" : 1, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "4", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "4" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } }, + "kind" : "INNER", "right" : { "filter" : { "condition" : { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "4", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "4" } ], - "type" : "BOOLEAN" + "operator" : "<" }, "source" : { "union" : [ { "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" }, { - "operator" : "7", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "7" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 7, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } ] } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(DEPTNO=[$0], DEPTNO0=[$1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($7, 4)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], DEPTNO0=[$1])\n LogicalJoin(condition=[=($0, $1)], joinType=[inner])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[<($7, 4)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalFilter(condition=[<($0, 4)])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[>($7, 7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$7])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json b/tests/calcite/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json index b504754..7e79093 100644 --- a/tests/calcite/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json +++ b/tests/calcite/testUncorrelatedCallInConjunctionIsFlattenedOnlyIfSiblingOfCorrelation.json @@ -1,14 +1,108 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[AND(<(+($0, 50), 20), >=($cor0.DEPTNO, +(30, $7)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(<(+($0, 50), 20), >=($cor0.DEPTNO, $9))])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+(30, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "operator" : "IS NOT NULL" + }, + "source" : { + "correlate" : { + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "50" + } ], + "operator" : "+" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "20" + } ], + "operator" : "<" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "30" + }, { + "column" : 16, + "type" : "INTEGER" + } ], + "operator" : "+" + } ], + "operator" : ">=" + } ], + "operator" : "AND" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] + } + } + } + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -36,173 +130,170 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, "source" : { - "correlate" : [ { - "scan" : 0 - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "<", + "correlate" : { + "left" : { + "scan" : 0 + }, + "kind" : "LEFT", + "right" : { + "group" : { + "keys" : [ ], + "function" : [ { + "distinct" : false, + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "BOOLEAN" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "+", + "type" : "BOOLEAN", "operand" : [ { - "column" : 9, - "type" : "INTEGER" + "type" : "INTEGER", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "50" + } ], + "operator" : "+" }, { - "operator" : "50", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "20" } ], - "type" : "INTEGER" + "operator" : "<" }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "+", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "30", - "operand" : [ ], + "column" : 7, "type" : "INTEGER" }, { - "column" : 16, + "column" : 18, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : ">=" } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 9, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "operator" : "+", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "50", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], + "operator" : "AND" + }, + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, "type" : "BOOLEAN" }, { - "operator" : ">=", + "type" : "INTEGER", "operand" : [ { - "column" : 7, - "type" : "INTEGER" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "30" }, { - "operator" : "+", - "operand" : [ { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - } ], + "column" : 16, "type" : "INTEGER" } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 + "operator" : "+" + } ] } } } - } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + }, { + "column" : 10, + "type" : "VARCHAR" + }, { + "column" : 11, + "type" : "VARCHAR" + }, { + "column" : 12, + "type" : "INTEGER" + }, { + "column" : 13, + "type" : "TIMESTAMP" + }, { + "column" : 14, + "type" : "INTEGER" + }, { + "column" : 15, + "type" : "INTEGER" + }, { + "column" : 16, + "type" : "INTEGER" + }, { + "column" : 17, + "type" : "BOOLEAN" + } ] } - } + }, + "target" : [ { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + } ] } } - } ] + } } - } ] + } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -230,305 +321,7 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "IS NOT NULL", - "operand" : [ { - "column" : 9, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "correlate" : [ { - "scan" : 0 - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ ], - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "operator" : "+", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "50", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 18, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 9, - "type" : "BOOLEAN" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "<", - "operand" : [ { - "operator" : "+", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "50", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "20", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 18, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "VARCHAR" - }, { - "column" : 11, - "type" : "VARCHAR" - }, { - "column" : 12, - "type" : "INTEGER" - }, { - "column" : 13, - "type" : "TIMESTAMP" - }, { - "column" : 14, - "type" : "INTEGER" - }, { - "column" : 15, - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - }, { - "column" : 17, - "type" : "BOOLEAN" - }, { - "operator" : "+", - "operand" : [ { - "operator" : "30", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 16, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } - } - } - } - } ] - } - } ] - } - } - } + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalFilter(condition=[AND(<(+($0, 50), 20), >=($cor0.DEPTNO, +(30, $7)))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[IS NOT NULL($9)])\n LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{7}])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{}], agg#0=[MIN($0)])\n LogicalProject($f0=[true])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[AND(<(+($0, 50), 20), >=($cor0.DEPTNO, $9))])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f9=[+(30, $7)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testUnionMergeRule.json b/tests/calcite/testUnionMergeRule.json index 983bddb..d343704 100644 --- a/tests/calcite/testUnionMergeRule.json +++ b/tests/calcite/testUnionMergeRule.json @@ -1,483 +1,267 @@ { + "help" : [ "LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalUnion(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { "union" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { "union" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } }, { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { "union" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 1, "type" : "VARCHAR" }, { - "column" : 1, + "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", + }, { + "type" : "INTEGER", "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "operator" : "1" + } ] } - } ] + } } }, { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 1, "type" : "VARCHAR" }, { - "column" : 1, + "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", + }, { + "type" : "INTEGER", "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "operator" : "1" + } ] } - } ] + } } } ] - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ] } } ] - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } ] - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ] } }, { "union" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } }, { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 1, "type" : "VARCHAR" }, { - "column" : 1, + "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", + }, { + "type" : "INTEGER", "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "operator" : "1" + } ] } - } ] + } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" }, { "column" : 1, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 1, "type" : "VARCHAR" }, { - "column" : 1, + "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", + }, { + "type" : "INTEGER", "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + "operator" : "1" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + }, { + "column" : 1, + "type" : "INTEGER" + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" }, { "column" : 0, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } ] - } ], - "help" : [ "LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalUnion(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalUnion(all=[true])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalUnion(all=[true])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$0], DEPTNO=[$1])\n LogicalAggregate(group=[{0, 1}], EXPR$2=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0], $f2=[1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testUnionToDistinctRule.json b/tests/calcite/testUnionToDistinctRule.json index 4725514..2c76425 100644 --- a/tests/calcite/testUnionToDistinctRule.json +++ b/tests/calcite/testUnionToDistinctRule.json @@ -1,147 +1,82 @@ { + "help" : [ "LogicalUnion(all=[false])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "distinct" : { "union" : [ { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } }, { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } + } ] } } ] } }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ], + "function" : [ ], + "source" : { + "union" : [ { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } + "column" : 1, + "type" : "VARCHAR" } ] } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "union" : [ { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - }, { - "project" : { - "target" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } ] - } - } + }, { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + } ] } - } - } ] + } ] + } } - } ], - "help" : [ "LogicalUnion(all=[false])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalAggregate(group=[{0, 1}])\n LogicalUnion(all=[true])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testWhereAnyCorrelatedInSelect.json b/tests/calcite/testWhereAnyCorrelatedInSelect.json index b9a018f..e7b5bfb 100644 --- a/tests/calcite/testWhereAnyCorrelatedInSelect.json +++ b/tests/calcite/testWhereAnyCorrelatedInSelect.json @@ -1,67 +1,31 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[> SOME($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], m=[CAST($9):INTEGER], c=[CAST($10):BIGINT], d=[CAST($11):BIGINT], trueLiteral=[CAST($12):BOOLEAN], NAME=[CAST($13):VARCHAR(10)])\n LogicalJoin(condition=[AND(=($2, $13), OR(AND(>($0, $9), IS NOT TRUE(OR(IS NULL($12), =($10, 0)))), AND(>($0, $9), IS NOT TRUE(OR(IS NULL($12), =($10, 0))), IS NOT TRUE(>($0, $9)), IS NOT TRUE(>($10, $11)))))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(m=[$1], c=[$2], d=[$2], trueLiteral=[true], NAME=[$0])\n LogicalAggregate(group=[{0}], m=[MIN($1)], c=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], - "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] - }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "> SOME", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "query" : { "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "VARCHAR" @@ -69,25 +33,31 @@ "column" : 10, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "scan" : 1 + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "> SOME" }, "source" : { - "scan" : 0 + "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -115,79 +85,18 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 10, - "type" : "BIGINT" - } ], - "type" : "BIGINT" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 11, - "type" : "BIGINT" - } ], - "type" : "BIGINT" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 12, - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 13, - "type" : "VARCHAR" - } ], - "type" : "VARCHAR" - } ], "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "VARCHAR" @@ -195,13 +104,13 @@ "column" : 13, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -209,39 +118,39 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "IS NOT TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 12, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "OR" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT TRUE" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -249,37 +158,37 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "IS NOT TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 12, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "OR" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT TRUE" }, { - "operator" : "IS NOT TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -287,13 +196,13 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT TRUE" }, { - "operator" : "IS NOT TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" @@ -301,21 +210,60 @@ "column" : 11, "type" : "BIGINT" } ], - "type" : "BOOLEAN" + "operator" : ">" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT TRUE" } ], - "type" : "BOOLEAN" + "operator" : "AND" } ], - "type" : "BOOLEAN" + "operator" : "OR" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { - "scan" : 0 + "scan" : 1 }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 0, + "type" : "INTEGER" + } ] + } + } + } + }, "target" : [ { "column" : 1, "type" : "INTEGER" @@ -326,98 +274,110 @@ "column" : 2, "type" : "BIGINT" }, { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, { "column" : 0, "type" : "VARCHAR" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - } + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "CAST" + }, { + "type" : "BIGINT", + "operand" : [ { + "column" : 10, + "type" : "BIGINT" + } ], + "operator" : "CAST" + }, { + "type" : "BIGINT", + "operand" : [ { + "column" : 11, + "type" : "BIGINT" + } ], + "operator" : "CAST" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 12, + "type" : "BOOLEAN" + } ], + "operator" : "CAST" + }, { + "type" : "VARCHAR", + "operand" : [ { + "column" : 13, + "type" : "VARCHAR" + } ], + "operator" : "CAST" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[> SOME($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], m=[CAST($9):INTEGER], c=[CAST($10):BIGINT], d=[CAST($11):BIGINT], trueLiteral=[CAST($12):BOOLEAN], NAME=[CAST($13):VARCHAR(10)])\n LogicalJoin(condition=[AND(=($2, $13), OR(AND(>($0, $9), IS NOT TRUE(OR(IS NULL($12), =($10, 0)))), AND(>($0, $9), IS NOT TRUE(OR(IS NULL($12), =($10, 0))), IS NOT TRUE(>($0, $9)), IS NOT TRUE(>($10, $11)))))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(m=[$1], c=[$2], d=[$2], trueLiteral=[true], NAME=[$0])\n LogicalAggregate(group=[{0}], m=[MIN($1)], c=[COUNT()])\n LogicalProject(NAME=[$1], DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testWhereExpressionInCorrelated.json b/tests/calcite/testWhereExpressionInCorrelated.json index cbe17fe..ad7f0be 100644 --- a/tests/calcite/testWhereExpressionInCorrelated.json +++ b/tests/calcite/testWhereExpressionInCorrelated.json @@ -1,64 +1,64 @@ { + "help" : [ "LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[IN($1, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[=(+($5, 1), $cor0.SALPLUS)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalProject(ENAME=[$1], DEPTNO=[$7], SALPLUS=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(ENAME=[$0])\n LogicalJoin(condition=[AND(=($2, $4), =($1, $3))], joinType=[inner])\n LogicalProject(ENAME=[$1], DEPTNO=[$7], SALPLUS=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], $f9=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "IN", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], "query" : { "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 8, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "INTEGER" + "operator" : "+" }, { "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 10, + "type" : "INTEGER" + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "IN" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" @@ -66,38 +66,34 @@ "column" : 7, "type" : "INTEGER" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "+" + } ] } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -105,9 +101,9 @@ "column" : 4, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "INTEGER" @@ -115,12 +111,15 @@ "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" @@ -128,117 +127,60 @@ "column" : 7, "type" : "INTEGER" }, { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "+" + } ] } }, + "kind" : "INNER", "right" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "+" + } ] } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] + } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[IN($1, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[=(+($5, 1), $cor0.SALPLUS)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalProject(ENAME=[$1], DEPTNO=[$7], SALPLUS=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(ENAME=[$0])\n LogicalJoin(condition=[AND(=($2, $4), =($1, $3))], joinType=[inner])\n LogicalProject(ENAME=[$1], DEPTNO=[$7], SALPLUS=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], $f9=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testWhereExpressionInCorrelated2.json b/tests/calcite/testWhereExpressionInCorrelated2.json index 6936c66..bbc0ef6 100644 --- a/tests/calcite/testWhereExpressionInCorrelated2.json +++ b/tests/calcite/testWhereExpressionInCorrelated2.json @@ -1,71 +1,71 @@ { + "help" : [ "LogicalProject(NAME=[$0])\n LogicalFilter(condition=[IN($1, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[=(+($5, 1), $cor0.DEPTNOMINUS)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalProject(NAME=[$1], DEPTNO=[$0], DEPTNOMINUS=[-($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0])\n LogicalJoin(condition=[AND(=($2, $4), =($1, $3))], joinType=[inner])\n LogicalProject(NAME=[$1], DEPTNO=[$0], DEPTNOMINUS=[-($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], $f9=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], - "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] - }, { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR" ], + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : "IN", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], "query" : { "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "+", + "type" : "INTEGER", "operand" : [ { "column" : 8, "type" : "INTEGER" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1" } ], - "type" : "INTEGER" + "operator" : "+" }, { "column" : 2, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "scan" : 1 + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 10, + "type" : "INTEGER" + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "IN" }, "source" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" @@ -73,38 +73,34 @@ "column" : 0, "type" : "INTEGER" }, { - "operator" : "-", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "-" + } ] } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "VARCHAR" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -112,9 +108,9 @@ "column" : 4, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "INTEGER" @@ -122,12 +118,15 @@ "column" : 3, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "project" : { + "source" : { + "scan" : 1 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" @@ -135,117 +134,60 @@ "column" : 0, "type" : "INTEGER" }, { - "operator" : "-", + "type" : "INTEGER", "operand" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "10" } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + "operator" : "-" + } ] } }, + "kind" : "INNER", "right" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" }, { - "column" : 1, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } + "type" : "INTEGER", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "+" + } ] } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "+", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } ] + } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ] } - } ], - "help" : [ "LogicalProject(NAME=[$0])\n LogicalFilter(condition=[IN($1, {\nLogicalProject(DEPTNO=[$7])\n LogicalFilter(condition=[=(+($5, 1), $cor0.DEPTNOMINUS)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalProject(NAME=[$1], DEPTNO=[$0], DEPTNOMINUS=[-($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(NAME=[$0])\n LogicalJoin(condition=[AND(=($2, $4), =($1, $3))], joinType=[inner])\n LogicalProject(NAME=[$1], DEPTNO=[$0], DEPTNOMINUS=[-($0, 10)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0, 1}])\n LogicalProject(DEPTNO=[$7], $f9=[+($5, 1)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testWhereInCorrelated.json b/tests/calcite/testWhereInCorrelated.json index 8737dc6..eb77c77 100644 --- a/tests/calcite/testWhereInCorrelated.json +++ b/tests/calcite/testWhereInCorrelated.json @@ -1,43 +1,31 @@ { + "help" : [ "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalJoin(condition=[AND(=($2, $10), =($0, $9))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], - "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] - }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "IN", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "query" : { "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "VARCHAR" @@ -45,36 +33,44 @@ "column" : 10, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "scan" : 1 + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "IN" }, "source" : { - "scan" : 0 + "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 5, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "VARCHAR" @@ -82,9 +78,9 @@ "column" : 10, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -92,30 +88,34 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { - "scan" : 0 + "scan" : 1 }, + "kind" : "INNER", "right" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } + } ] } } } - } + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalJoin(condition=[AND(=($2, $10), =($0, $9))], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testWhereInJoinCorrelated.json b/tests/calcite/testWhereInJoinCorrelated.json index 08180a1..1ec80ff 100644 --- a/tests/calcite/testWhereInJoinCorrelated.json +++ b/tests/calcite/testWhereInJoinCorrelated.json @@ -1,43 +1,31 @@ { + "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IN($5, {\nLogicalProject(SAL=[$5])\n LogicalFilter(condition=[>($7, $cor0.DEPTNO)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalFilter(condition=[=($5, $11)])\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{7}])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(SAL=[$5])\n LogicalFilter(condition=[>($7, $cor0.DEPTNO)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "IN", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], "query" : { "project" : { - "target" : [ { - "column" : 16, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 18, "type" : "INTEGER" @@ -45,22 +33,30 @@ "column" : 7, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "scan" : 0 } } - } + }, + "target" : [ { + "column" : 16, + "type" : "INTEGER" + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "IN" }, "source" : { "join" : { - "kind" : "INNER", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 7, "type" : "INTEGER" @@ -68,27 +64,105 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "INNER", "right" : { "scan" : 1 } } } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 11, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "source" : { + "correlate" : { + "left" : { + "join" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 9, + "type" : "INTEGER" + } ], + "operator" : "=" + }, + "left" : { + "scan" : 0 + }, + "kind" : "INNER", + "right" : { + "scan" : 1 + } + } + }, + "kind" : "INNER", + "right" : { + "group" : { + "keys" : [ { + "column" : 11, + "type" : "INTEGER" + } ], + "function" : [ ], + "source" : { + "project" : { + "source" : { + "filter" : { + "condition" : { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 18, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + } ], + "operator" : ">" + }, + "source" : { + "scan" : 0 + } + } + }, + "target" : [ { + "column" : 16, + "type" : "INTEGER" + } ] + } + } + } + } + } + } + } + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -122,135 +196,13 @@ }, { "column" : 10, "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 11, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "correlate" : [ { - "join" : { - "kind" : "INNER", - "condition" : { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "left" : { - "scan" : 0 - }, - "right" : { - "scan" : 1 - } - } - }, { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 16, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 18, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 12, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 17, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 19, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - } ] - } - } ] - } - } - } + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0])\n LogicalFilter(condition=[IN($5, {\nLogicalProject(SAL=[$5])\n LogicalFilter(condition=[>($7, $cor0.DEPTNO)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n})], variablesSet=[[$cor0]])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n", "LogicalProject(EMPNO=[$0])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$9], NAME=[$10])\n LogicalFilter(condition=[=($5, $11)])\n LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{7}])\n LogicalJoin(condition=[=($7, $9)], joinType=[inner])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalAggregate(group=[{0}])\n LogicalProject(SAL=[$5])\n LogicalFilter(condition=[>($7, $cor0.DEPTNO)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testWhereNotInCorrelated.json b/tests/calcite/testWhereNotInCorrelated.json index 9a3516e..328b3e0 100644 --- a/tests/calcite/testWhereNotInCorrelated.json +++ b/tests/calcite/testWhereNotInCorrelated.json @@ -1,45 +1,33 @@ { + "help" : [ "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[NOT(IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[OR(=($9, 0), IS NOT TRUE(OR(IS NOT NULL($13), <($10, $9))))])\n LogicalJoin(condition=[AND(=($0, $12), =($2, $14))], joinType=[left])\n LogicalJoin(condition=[=($2, $11)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(c=[$1], ck=[$1], NAME=[$0])\n LogicalAggregate(group=[{0}], c=[COUNT()])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], i=[true], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], - "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] - }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 5, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "NOT", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IN", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "query" : { "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "VARCHAR" @@ -47,59 +35,68 @@ "column" : 10, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "source" : { - "scan" : 1 + "scan" : 0 } } - } + }, + "target" : [ { + "column" : 9, + "type" : "INTEGER" + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "IN" } ], - "type" : "BOOLEAN" + "operator" : "NOT" }, "source" : { - "scan" : 0 + "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 5, "type" : "INTEGER" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "IS NOT TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 13, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" @@ -107,21 +104,20 @@ "column" : 9, "type" : "BIGINT" } ], - "type" : "BOOLEAN" + "operator" : "<" } ], - "type" : "BOOLEAN" + "operator" : "OR" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT TRUE" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -129,9 +125,9 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "VARCHAR" @@ -139,15 +135,14 @@ "column" : 14, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "VARCHAR" @@ -155,13 +150,40 @@ "column" : 11, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "scan" : 0 + "scan" : 1 }, + "kind" : "LEFT", "right" : { "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 1, + "type" : "VARCHAR" + } ] + } + } + } + }, "target" : [ { "column" : 1, "type" : "BIGINT" @@ -171,97 +193,38 @@ }, { "column" : 0, "type" : "VARCHAR" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } - } - } - } - } - } - } ] - } - } + } ] } } } }, + "kind" : "LEFT", "right" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" + "operator" : "true" }, { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "scan" : 1 - } + } ] } } } } } - } + }, + "target" : [ { + "column" : 5, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[NOT(IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalFilter(condition=[=($cor0.JOB, $1)])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(SAL=[$5])\n LogicalFilter(condition=[OR(=($9, 0), IS NOT TRUE(OR(IS NOT NULL($13), <($10, $9))))])\n LogicalJoin(condition=[AND(=($0, $12), =($2, $14))], joinType=[left])\n LogicalJoin(condition=[=($2, $11)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(c=[$1], ck=[$1], NAME=[$0])\n LogicalAggregate(group=[{0}], c=[COUNT()])\n LogicalProject(NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n LogicalProject(DEPTNO=[$0], i=[true], NAME=[$1])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testWhereNotInCorrelated2.json b/tests/calcite/testWhereNotInCorrelated2.json index 68691d2..b61240f 100644 --- a/tests/calcite/testWhereNotInCorrelated2.json +++ b/tests/calcite/testWhereNotInCorrelated2.json @@ -1,75 +1,39 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[NOT(IN($0, {\nLogicalProject(EMPNO=[$1])\n LogicalFilter(condition=[AND(>($2, 2), =($cor0.ENAME, $0))])\n LogicalProject(ENAME=[$1], EMPNO=[$0], R=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(=($9, 0), IS NOT TRUE(OR(IS NOT NULL($13), <($10, $9))))])\n LogicalJoin(condition=[AND(=($0, $12), =($1, $14))], joinType=[left])\n LogicalJoin(condition=[=($1, $11)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(c=[$1], ck=[$1], ENAME=[$0])\n LogicalAggregate(group=[{0}], c=[COUNT()])\n LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[>($2, 2)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], R=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$1], i=[true], ENAME=[$0])\n LogicalFilter(condition=[>($2, 2)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], R=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "NOT", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IN", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "query" : { "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 11, "type" : "INTEGER" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -77,12 +41,15 @@ "column" : 9, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 10, "type" : "VARCHAR" @@ -92,28 +59,31 @@ }, { "column" : 14, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } } - } + }, + "target" : [ { + "column" : 10, + "type" : "INTEGER" + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "IN" } ], - "type" : "BOOLEAN" + "operator" : "NOT" }, "source" : { "scan" : 0 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -141,35 +111,38 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "IS NOT TRUE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IS NOT NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 13, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT NULL" }, { - "operator" : "<", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BIGINT" @@ -177,21 +150,20 @@ "column" : 9, "type" : "BIGINT" } ], - "type" : "BOOLEAN" + "operator" : "<" } ], - "type" : "BOOLEAN" + "operator" : "OR" } ], - "type" : "BOOLEAN" + "operator" : "IS NOT TRUE" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -199,9 +171,9 @@ "column" : 12, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -209,15 +181,14 @@ "column" : 14, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, "left" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 1, "type" : "VARCHAR" @@ -225,179 +196,106 @@ "column" : 11, "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { "scan" : 0 }, + "kind" : "LEFT", "right" : { "project" : { - "target" : [ { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 1, - "type" : "BIGINT" - }, { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], "source" : { "filter" : { "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" + "column" : 2, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : ">", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } + }, { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "VARCHAR" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 1, + "type" : "BIGINT" + }, { + "column" : 0, + "type" : "VARCHAR" + } ] } } } }, + "kind" : "LEFT", "right" : { "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "operator" : "true", - "operand" : [ ], - "type" : "BOOLEAN" - }, { - "column" : 0, - "type" : "VARCHAR" - } ], "source" : { "filter" : { "condition" : { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { "column" : 2, "type" : "INTEGER" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "BOOLEAN" + "operator" : ">" }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 1, "type" : "VARCHAR" @@ -407,21 +305,56 @@ }, { "column" : 5, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } } - } + }, + "target" : [ { + "column" : 1, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ ], + "operator" : "true" + }, { + "column" : 0, + "type" : "VARCHAR" + } ] } } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[NOT(IN($0, {\nLogicalProject(EMPNO=[$1])\n LogicalFilter(condition=[AND(>($2, 2), =($cor0.ENAME, $0))])\n LogicalProject(ENAME=[$1], EMPNO=[$0], R=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n}))], variablesSet=[[$cor0]])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(=($9, 0), IS NOT TRUE(OR(IS NOT NULL($13), <($10, $9))))])\n LogicalJoin(condition=[AND(=($0, $12), =($1, $14))], joinType=[left])\n LogicalJoin(condition=[=($1, $11)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(c=[$1], ck=[$1], ENAME=[$0])\n LogicalAggregate(group=[{0}], c=[COUNT()])\n LogicalProject(ENAME=[$0])\n LogicalFilter(condition=[>($2, 2)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], R=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(EMPNO=[$1], i=[true], ENAME=[$0])\n LogicalFilter(condition=[>($2, 2)])\n LogicalProject(ENAME=[$1], EMPNO=[$0], R=[$5])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testWhereOrSubQuery.json b/tests/calcite/testWhereOrSubQuery.json index f4fd362..1385e10 100644 --- a/tests/calcite/testWhereOrSubQuery.json +++ b/tests/calcite/testWhereOrSubQuery.json @@ -1,97 +1,67 @@ { + "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(=($5, 4), NOT(IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(=($5, 4), IS NULL($10))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], i=[true])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], - "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] - }, { - "name" : "DEPT", - "fields" : [ "DEPTNO", "NAME" ], "types" : [ "INTEGER", "VARCHAR" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false ], + "name" : "CATALOG.SALES.DEPT", + "guaranteed" : [ ], + "fields" : [ "DEPTNO", "NAME" ], + "key" : [ [ 0 ] ] + }, { + "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "4", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "4" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "NOT", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "IN", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "query" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 9, "type" : "INTEGER" - } ], - "source" : { - "scan" : 1 - } + } ] } }, - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "operator" : "IN" } ], - "type" : "BOOLEAN" + "operator" : "NOT" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { - "scan" : 0 + "scan" : 1 } } - } - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -119,67 +89,41 @@ }, { "column" : 8, "type" : "BOOLEAN" - } ], + } ] + } + }, { + "project" : { "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "TIMESTAMP" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "BOOLEAN" - } ], "source" : { "filter" : { "condition" : { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 5, "type" : "INTEGER" }, { - "operator" : "4", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "4" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "IS NULL", + "type" : "BOOLEAN", "operand" : [ { "column" : 10, "type" : "BOOLEAN" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, "source" : { "join" : { - "kind" : "LEFT", "condition" : { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 0, "type" : "INTEGER" @@ -187,33 +131,89 @@ "column" : 9, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" }, "left" : { - "scan" : 0 + "scan" : 1 }, + "kind" : "LEFT", "right" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "operator" : "true", + "type" : "BOOLEAN", "operand" : [ ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 1 - } + "operator" : "true" + } ] } } } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "VARCHAR" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "TIMESTAMP" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 8, + "type" : "BOOLEAN" + } ] } - } ], - "help" : [ "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(=($5, 4), NOT(IN($0, {\nLogicalProject(DEPTNO=[$0])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n})))])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])\n LogicalFilter(condition=[OR(=($5, 4), IS NULL($10))])\n LogicalJoin(condition=[=($0, $9)], joinType=[left])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n LogicalProject(DEPTNO=[$0], i=[true])\n LogicalTableScan(table=[[CATALOG, SALES, DEPT]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testWithinDistinct.json b/tests/calcite/testWithinDistinct.json index 4af0d09..379db28 100644 --- a/tests/calcite/testWithinDistinct.json +++ b/tests/calcite/testWithinDistinct.json @@ -1,556 +1,240 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[SUM($1) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], $f1=[CAST($1):INTEGER NOT NULL], $f2=[$2])\n LogicalAggregate(group=[{0}], agg#0=[MIN($1) FILTER $3], agg#1=[$SUM0($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f3=[$3], $f6=[=($5, 1)], $f7=[AND(=($5, 0), $THROW_UNLESS(OR(<>($5, 0), =($3, $4)), 'more than one distinct value in agg UNIQUE_VALUE'))])\n LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}]], agg#0=[$SUM0($1)], agg#1=[MIN($1)], agg#2=[MAX($1)], agg#3=[GROUPING($0, $2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 2, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "MIN", + "ignoreNulls" : false }, { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "$SUM0", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 2, - "type" : "INTEGER" + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false }, { - "column" : 3, - "type" : "INTEGER" + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false }, { - "operator" : "=", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 5, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], + "column" : 1, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "MAX", + "ignoreNulls" : false }, { - "operator" : "AND", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 0, + "type" : "INTEGER" }, { - "operator" : "$THROW_UNLESS", - "operand" : [ { - "operator" : "OR", - "operand" : [ { - "operator" : "<>", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" + "column" : 2, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "GROUPING", + "ignoreNulls" : false } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" } ] } } } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + }, + "target" : [ { + "column" : 0, "type" : "INTEGER" }, { - "operator" : "$SUM0", + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", "operand" : [ { - "column" : 3, - "type" : "INTEGER" + "column" : 5, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 0, - "type" : "INTEGER" + "column" : 5, + "type" : "BIGINT" }, { - "column" : 1, - "type" : "INTEGER" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { + "operator" : "<>" + }, { + "type" : "BOOLEAN", + "operand" : [ { "column" : 3, "type" : "INTEGER" }, { "column" : 4, "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "$THROW_UNLESS", - "operand" : [ { - "operator" : "OR", - "operand" : [ { - "operator" : "<>", - "operand" : [ { - "column" : 6, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } + "operator" : "=" + } ], + "operator" : "OR" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'" + } ], + "operator" : "$THROW_UNLESS" + } ], + "operator" : "AND" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "CAST" + }, { + "column" : 2, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[SUM($1) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], $f1=[CAST($1):INTEGER NOT NULL], $f2=[$2])\n LogicalAggregate(group=[{0}], agg#0=[MIN($1) FILTER $3], agg#1=[$SUM0($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f3=[$3], $f6=[=($5, 1)], $f7=[AND(=($5, 0), $THROW_UNLESS(OR(<>($5, 0), =($3, $4)), 'more than one distinct value in agg UNIQUE_VALUE'))])\n LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}]], agg#0=[$SUM0($1)], agg#1=[MIN($1)], agg#2=[MAX($1)], agg#3=[GROUPING($0, $2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testWithinDistinctCountDistinct.json b/tests/calcite/testWithinDistinctCountDistinct.json index 9dd4602..0688a3a 100644 --- a/tests/calcite/testWithinDistinctCountDistinct.json +++ b/tests/calcite/testWithinDistinctCountDistinct.json @@ -1,679 +1,295 @@ { + "help" : [ "LogicalAggregate(group=[{0}], SS_C=[SUM($1) WITHIN DISTINCT ($2)], CDJ=[COUNT(DISTINCT $3)], CJ_J=[COUNT() WITHIN DISTINCT ($3)], CDJ_J=[COUNT(DISTINCT $3) WITHIN DISTINCT ($3)], CDJ_FILTERED=[COUNT(DISTINCT $3) FILTER $4])\n LogicalProject(DEPTNO=[$7], SAL=[$5], COMM=[$6], JOB=[$2], $f4=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], $f1=[$1], $f2=[$2], $f20=[$2], $f21=[$2], $f3=[$3])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[COUNT($2) FILTER $5])\n LogicalProject(DEPTNO=[$0], $f3=[$3], $f4=[$4], $f7=[=($6, 1)], $f8=[=($6, 2)], $f9=[AND(=($6, 2), >($5, 0))])\n LogicalAggregate(group=[{0, 2, 3}], groups=[[{0, 2}, {0, 3}]], agg#0=[MIN($1)], agg#1=[MIN($3) FILTER $4], agg#2=[COUNT() FILTER $4], agg#3=[GROUPING($0, $2, $3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], COMM=[$6], JOB=[$2], $f4=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : true, + "type" : "BIGINT", + "operand" : [ { + "column" : 3, + "type" : "VARCHAR" + } ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1000" + } ], + "operator" : ">" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 2, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "$SUM0", + "ignoreNulls" : false }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], "operator" : "COUNT", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" + "ignoreNulls" : false }, { - "operator" : "COUNT", - "operand" : [ ], "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "COUNT", + "type" : "BIGINT", "operand" : [ { - "column" : 4, + "column" : 2, "type" : "VARCHAR" } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { "operator" : "COUNT", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - } ], - "distinct" : true, - "ignoreNulls" : false, - "type" : "BIGINT" + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, + "project" : { "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" }, { - "column" : 7, + "column" : 2, "type" : "INTEGER" }, { "column" : 3, "type" : "VARCHAR" - }, { - "operator" : ">", + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], + "column" : 1, "type" : "INTEGER" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "BIGINT" - }, { - "column" : 2, - "type" : "BIGINT" - }, { - "column" : 2, - "type" : "BIGINT" - }, { - "column" : 3, - "type" : "BIGINT" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" + "operator" : "MIN", + "ignoreNulls" : false }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "=", + "distinct" : false, + "type" : "VARCHAR", "operand" : [ { - "column" : 6, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" + "column" : 3, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false }, { - "operator" : "=", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 6, - "type" : "BIGINT" + "column" : 0, + "type" : "INTEGER" }, { - "operator" : "2", - "operand" : [ ], + "column" : 2, "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "BIGINT" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 3, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "GROUPING", + "ignoreNulls" : false } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 6, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "VARCHAR" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "operator" : ">", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "COUNT", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 1, + "column" : 7, "type" : "INTEGER" }, { - "column" : 4, + "column" : 5, "type" : "INTEGER" }, { - "column" : 5, + "column" : 6, + "type" : "INTEGER" + }, { + "column" : 2, "type" : "VARCHAR" }, { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 7, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], + "column" : 5, "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "BIGINT" }, { - "operator" : "2", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "1000" } ], - "type" : "BOOLEAN" - }, { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "BIGINT" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 7, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "VARCHAR" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "operator" : ">", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "1000", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } + "operator" : ">" + } ] } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "VARCHAR" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 6, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : ">" + } ], + "operator" : "AND" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "column" : 3, + "type" : "BIGINT" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], SS_C=[SUM($1) WITHIN DISTINCT ($2)], CDJ=[COUNT(DISTINCT $3)], CJ_J=[COUNT() WITHIN DISTINCT ($3)], CDJ_J=[COUNT(DISTINCT $3) WITHIN DISTINCT ($3)], CDJ_FILTERED=[COUNT(DISTINCT $3) FILTER $4])\n LogicalProject(DEPTNO=[$7], SAL=[$5], COMM=[$6], JOB=[$2], $f4=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], $f1=[$1], $f2=[$2], $f20=[$2], $f21=[$2], $f3=[$3])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[COUNT($2) FILTER $5])\n LogicalProject(DEPTNO=[$0], $f3=[$3], $f4=[$4], $f7=[=($6, 1)], $f8=[=($6, 2)], $f9=[AND(=($6, 2), >($5, 0))])\n LogicalAggregate(group=[{0, 2, 3}], groups=[[{0, 2}, {0, 3}]], agg#0=[MIN($1)], agg#1=[MIN($3) FILTER $4], agg#2=[COUNT() FILTER $4], agg#3=[GROUPING($0, $2, $3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], COMM=[$6], JOB=[$2], $f4=[>($5, 1000)])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testWithinDistinctFilteredAggs.json b/tests/calcite/testWithinDistinctFilteredAggs.json index 688b06e..0d73770 100644 --- a/tests/calcite/testWithinDistinctFilteredAggs.json +++ b/tests/calcite/testWithinDistinctFilteredAggs.json @@ -1,1167 +1,549 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($1) FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/($3, $4)):INTEGER])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $f2=[$2], $f3=[CASE(=($4, 0), null:INTEGER, $3)], $f4=[$4])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[$SUM0($2) FILTER $5], agg#3=[COUNT() FILTER $6])\n LogicalProject(DEPTNO=[$0], $f3=[$3], $f6=[$6], $f10=[AND(=($9, 2), >($5, 0), $THROW_UNLESS(OR(<>($9, 2), AND(IS NULL($3), IS NULL($4)), IS TRUE(=($3, $4))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f11=[AND(=($9, 2), >($5, 0))], $f12=[AND(=($9, 1), >($8, 0), $THROW_UNLESS(OR(<>($9, 1), AND(IS NULL($6), IS NULL($7)), IS TRUE(=($6, $7))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f13=[AND(=($9, 1), >($8, 0))])\n LogicalAggregate(group=[{0, 1, 3}], groups=[[{0, 1}, {0, 3}]], agg#0=[MIN($1) FILTER $2], agg#1=[MAX($1) FILTER $2], agg#2=[COUNT() FILTER $2], agg#3=[MIN($4) FILTER $5], agg#4=[MAX($4) FILTER $5], agg#5=[COUNT() FILTER $5], agg#6=[GROUPING($0, $1, $3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "AVG", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" - }, { - "operator" : "CASE", + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - }, { "column" : 1, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "SUM", + "ignoreNulls" : false }, { - "operator" : "CAST", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "operator" : "/", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "BIGINT" - } ], - "type" : "BIGINT" + "column" : 4, + "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "AVG", + "ignoreNulls" : false } ], "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" }, { - "column" : 1, + "column" : 5, "type" : "INTEGER" }, { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "CASE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "NULL", - "operand" : [ ], + "column" : 6, "type" : "INTEGER" }, { - "column" : 3, - "type" : "INTEGER" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" } ], + "operator" : ">" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, "type" : "INTEGER" }, { - "column" : 4, - "type" : "BIGINT" - } ], + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'%ok%'" + } ], + "operator" : "LIKE" + } ] + } + } + } + }, { + "project" : { + "source" : { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" }, { - "column" : 3, + "column" : 1, "type" : "INTEGER" }, { - "column" : 6, - "type" : "INTEGER" + "column" : 3, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false }, { - "operator" : "AND", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "BIGINT" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "operator" : "GROUPING", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "operator" : "0", - "operand" : [ ], + "column" : 5, "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "$THROW_UNLESS", - "operand" : [ { - "operator" : "OR", + }, { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<>", - "operand" : [ { - "column" : 9, - "type" : "BIGINT" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS NULL", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "column" : 6, + "type" : "INTEGER" }, { - "operator" : "IS TRUE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "BIGINT" + "column" : 2, + "type" : "VARCHAR" }, { - "operator" : "2", - "operand" : [ ], + "column" : 6, "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'%ok%'" + } ], + "operator" : "LIKE" + } ] + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" }, { - "operator" : "AND", + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : ">" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 9, "type" : "BIGINT" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "BOOLEAN" + "operator" : "<>" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { - "column" : 8, - "type" : "BIGINT" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "$THROW_UNLESS", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<>", - "operand" : [ { - "column" : 9, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS NULL", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "column" : 3, + "type" : "INTEGER" }, { - "operator" : "IS TRUE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "column" : 4, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand" : [ ], - "type" : "CHAR" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "IS TRUE" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 8, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'" } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" + "operator" : "$THROW_UNLESS" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "AND" }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "$SUM0", + "type" : "BOOLEAN", "operand" : [ { - "column" : 3, - "type" : "INTEGER" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : ">" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "AND" }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : ">" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 0, - "type" : "INTEGER" + "column" : 9, + "type" : "BIGINT" }, { - "column" : 1, - "type" : "INTEGER" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "BIGINT" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "$THROW_UNLESS", - "operand" : [ { - "operator" : "OR", - "operand" : [ { - "operator" : "<>", - "operand" : [ { - "column" : 10, - "type" : "BIGINT" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS NULL", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS TRUE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "AND", + "operator" : "<>" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "BIGINT" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 6, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 9, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "$THROW_UNLESS", - "operand" : [ { - "operator" : "OR", - "operand" : [ { - "operator" : "<>", - "operand" : [ { - "column" : 10, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS NULL", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS TRUE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" - }, { - "operator" : "AND", + "operator" : "IS NULL" + } ], + "operator" : "AND" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 10, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 6, + "type" : "INTEGER" }, { - "operator" : ">", - "operand" : [ { - "column" : 9, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 5, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } + "operator" : "IS TRUE" + } ], + "operator" : "OR" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'" + } ], + "operator" : "$THROW_UNLESS" + } ], + "operator" : "AND" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 9, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : ">" + } ], + "operator" : "AND" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "CASE" + }, { + "column" : 4, + "type" : "BIGINT" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "CASE" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BIGINT", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "operator" : "/" + } ], + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($1) FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/($3, $4)):INTEGER])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $f2=[$2], $f3=[CASE(=($4, 0), null:INTEGER, $3)], $f4=[$4])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[$SUM0($2) FILTER $5], agg#3=[COUNT() FILTER $6])\n LogicalProject(DEPTNO=[$0], $f3=[$3], $f6=[$6], $f10=[AND(=($9, 2), >($5, 0), $THROW_UNLESS(OR(<>($9, 2), AND(IS NULL($3), IS NULL($4)), IS TRUE(=($3, $4))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f11=[AND(=($9, 2), >($5, 0))], $f12=[AND(=($9, 1), >($8, 0), $THROW_UNLESS(OR(<>($9, 1), AND(IS NULL($6), IS NULL($7)), IS TRUE(=($6, $7))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f13=[AND(=($9, 1), >($8, 0))])\n LogicalAggregate(group=[{0, 1, 3}], groups=[[{0, 1}, {0, 3}]], agg#0=[MIN($1) FILTER $2], agg#1=[MAX($1) FILTER $2], agg#2=[COUNT() FILTER $2], agg#3=[MIN($4) FILTER $5], agg#4=[MAX($4) FILTER $5], agg#5=[COUNT() FILTER $5], agg#6=[GROUPING($0, $1, $3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testWithinDistinctFilteredAggsSameFilter.json b/tests/calcite/testWithinDistinctFilteredAggsSameFilter.json index 7778bf1..738fe18 100644 --- a/tests/calcite/testWithinDistinctFilteredAggsSameFilter.json +++ b/tests/calcite/testWithinDistinctFilteredAggsSameFilter.json @@ -1,1089 +1,521 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($1) FILTER $2])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[LIKE($1, '%ok%')], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/($3, $4)):INTEGER])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $f2=[$2], $f3=[CASE(=($4, 0), null:INTEGER, $3)], $f4=[$4])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[$SUM0($2) FILTER $5], agg#3=[COUNT() FILTER $6])\n LogicalProject(DEPTNO=[$0], $f3=[$3], $f6=[$6], $f9=[AND(=($8, 2), >($5, 0), $THROW_UNLESS(OR(<>($8, 2), AND(IS NULL($3), IS NULL($4)), IS TRUE(=($3, $4))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f10=[AND(=($8, 2), >($5, 0))], $f11=[AND(=($8, 1), >($5, 0), $THROW_UNLESS(OR(<>($8, 1), AND(IS NULL($6), IS NULL($7)), IS TRUE(=($6, $7))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f12=[AND(=($8, 1), >($5, 0))])\n LogicalAggregate(group=[{0, 1, 3}], groups=[[{0, 1}, {0, 3}]], agg#0=[MIN($1) FILTER $2], agg#1=[MAX($1) FILTER $2], agg#2=[COUNT() FILTER $2], agg#3=[MIN($4) FILTER $2], agg#4=[MAX($4) FILTER $2], agg#5=[GROUPING($0, $1, $3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[LIKE($1, '%ok%')], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "AVG", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" - }, { - "operator" : "CASE", + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - }, { "column" : 1, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "SUM", + "ignoreNulls" : false }, { - "operator" : "CAST", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "operator" : "/", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "BIGINT" - } ], - "type" : "BIGINT" + "column" : 4, + "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "AVG", + "ignoreNulls" : false } ], "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" }, { - "column" : 1, + "column" : 5, "type" : "INTEGER" }, { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "CASE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "VARCHAR" }, { - "operator" : "NULL", + "type" : "CHAR", "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" + "operator" : "_ISO-8859-1'%ok%'" } ], - "type" : "INTEGER" + "operator" : "LIKE" }, { - "column" : 4, - "type" : "BIGINT" - } ], + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + } ] + } + } + } + }, { + "project" : { + "source" : { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" }, { - "column" : 3, + "column" : 1, "type" : "INTEGER" }, { - "column" : 6, - "type" : "INTEGER" + "column" : 3, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false }, { - "operator" : "AND", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "BIGINT" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ { + "column" : 0, + "type" : "INTEGER" }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "operator" : "GROUPING", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" }, { - "operator" : "0", - "operand" : [ ], + "column" : 5, "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "$THROW_UNLESS", - "operand" : [ { - "operator" : "OR", + }, { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<>", - "operand" : [ { - "column" : 8, - "type" : "BIGINT" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS NULL", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "VARCHAR" }, { - "operator" : "IS TRUE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'%ok%'" } ], - "type" : "BOOLEAN" + "operator" : "LIKE" }, { - "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "BIGINT" + "column" : 2, + "type" : "VARCHAR" }, { - "operator" : "2", - "operand" : [ ], + "column" : 6, "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + } ] + } + } + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" }, { - "operator" : "AND", + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : ">" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 8, "type" : "BIGINT" }, { - "operator" : "1", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "2" } ], - "type" : "BOOLEAN" + "operator" : "<>" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { - "column" : 5, - "type" : "BIGINT" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" } ], - "type" : "BOOLEAN" + "operator" : "AND" }, { - "operator" : "$THROW_UNLESS", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "OR", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "<>", - "operand" : [ { - "column" : 8, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 3, + "type" : "INTEGER" }, { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS NULL", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS TRUE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "column" : 4, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand" : [ ], - "type" : "CHAR" + "operator" : "=" } ], - "type" : "BOOLEAN" + "operator" : "IS TRUE" } ], - "type" : "BOOLEAN" + "operator" : "OR" }, { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 8, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'" } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" + "operator" : "$THROW_UNLESS" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "operator" : "AND" }, { - "operator" : "$SUM0", + "type" : "BOOLEAN", "operand" : [ { - "column" : 3, - "type" : "INTEGER" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "2" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : ">" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "AND" }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : ">" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 0, - "type" : "INTEGER" + "column" : 8, + "type" : "BIGINT" }, { - "column" : 1, - "type" : "INTEGER" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "BIGINT" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "$THROW_UNLESS", - "operand" : [ { - "operator" : "OR", - "operand" : [ { - "operator" : "<>", - "operand" : [ { - "column" : 9, - "type" : "BIGINT" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS NULL", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS TRUE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "AND", + "operator" : "<>" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "BIGINT" - }, { - "operator" : "2", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 6, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "$THROW_UNLESS", - "operand" : [ { - "operator" : "OR", - "operand" : [ { - "operator" : "<>", - "operand" : [ { - "column" : 9, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS NULL", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS TRUE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" - }, { - "operator" : "AND", + "operator" : "IS NULL" + } ], + "operator" : "AND" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 9, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 6, + "type" : "INTEGER" }, { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 7, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 11, - "type" : "INTEGER" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 5, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - }, { - "column" : 6, - "type" : "VARCHAR" - }, { - "column" : 10, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } + "operator" : "IS TRUE" + } ], + "operator" : "OR" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'" + } ], + "operator" : "$THROW_UNLESS" + } ], + "operator" : "AND" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 8, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" + } ], + "operator" : "=" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 5, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : ">" + } ], + "operator" : "AND" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "CASE" + }, { + "column" : 4, + "type" : "BIGINT" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "CASE" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BIGINT", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "operator" : "/" + } ], + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($1) FILTER $2])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[LIKE($1, '%ok%')], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/($3, $4)):INTEGER])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $f2=[$2], $f3=[CASE(=($4, 0), null:INTEGER, $3)], $f4=[$4])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[$SUM0($2) FILTER $5], agg#3=[COUNT() FILTER $6])\n LogicalProject(DEPTNO=[$0], $f3=[$3], $f6=[$6], $f9=[AND(=($8, 2), >($5, 0), $THROW_UNLESS(OR(<>($8, 2), AND(IS NULL($3), IS NULL($4)), IS TRUE(=($3, $4))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f10=[AND(=($8, 2), >($5, 0))], $f11=[AND(=($8, 1), >($5, 0), $THROW_UNLESS(OR(<>($8, 1), AND(IS NULL($6), IS NULL($7)), IS TRUE(=($6, $7))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f12=[AND(=($8, 1), >($5, 0))])\n LogicalAggregate(group=[{0, 1, 3}], groups=[[{0, 1}, {0, 3}]], agg#0=[MIN($1) FILTER $2], agg#1=[MAX($1) FILTER $2], agg#2=[COUNT() FILTER $2], agg#3=[MIN($4) FILTER $2], agg#4=[MAX($4) FILTER $2], agg#5=[GROUPING($0, $1, $3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[LIKE($1, '%ok%')], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testWithinDistinctFilteredAggsUniformDistinctKeys.json b/tests/calcite/testWithinDistinctFilteredAggsUniformDistinctKeys.json index 49901cf..7257c77 100644 --- a/tests/calcite/testWithinDistinctFilteredAggsUniformDistinctKeys.json +++ b/tests/calcite/testWithinDistinctFilteredAggsUniformDistinctKeys.json @@ -1,963 +1,457 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($3) FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/($3, $4)):INTEGER])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $f2=[$2], $f3=[CASE(=($4, 0), null:INTEGER, $3)], $f4=[$4])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[$SUM0($2) FILTER $5], agg#3=[COUNT() FILTER $6])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f5=[$5], $f8=[AND(>($4, 0), $THROW_UNLESS(OR(AND(IS NULL($2), IS NULL($3)), IS TRUE(=($2, $3))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f9=[>($4, 0)], $f10=[AND(>($7, 0), $THROW_UNLESS(OR(AND(IS NULL($5), IS NULL($6)), IS TRUE(=($5, $6))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f11=[>($7, 0)])\n LogicalAggregate(group=[{0, 3}], agg#0=[MIN($1) FILTER $2], agg#1=[MAX($1) FILTER $2], agg#2=[COUNT() FILTER $2], agg#3=[MIN($4) FILTER $5], agg#4=[MAX($4) FILTER $5], agg#5=[COUNT() FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "AVG", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" - }, { - "operator" : "CASE", + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - }, { "column" : 1, "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "SUM", + "ignoreNulls" : false }, { - "operator" : "CAST", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "operator" : "/", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "BIGINT" - } ], - "type" : "BIGINT" + "column" : 4, + "type" : "INTEGER" } ], - "type" : "INTEGER" + "operator" : "AVG", + "ignoreNulls" : false } ], "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" }, { - "column" : 1, + "column" : 5, "type" : "INTEGER" }, { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "CASE", + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "NULL", - "operand" : [ ], + "column" : 6, "type" : "INTEGER" }, { - "column" : 3, - "type" : "INTEGER" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" } ], + "operator" : ">" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, "type" : "INTEGER" }, { - "column" : 4, - "type" : "BIGINT" - } ], + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'%ok%'" + } ], + "operator" : "LIKE" + } ] + } + } + } + }, { + "project" : { + "source" : { + "project" : { "source" : { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" + "column" : 3, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false }, { - "operator" : "AND", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "operator" : ">", - "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "$THROW_UNLESS", - "operand" : [ { - "operator" : "OR", - "operand" : [ { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS NULL", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS TRUE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "MAX", + "ignoreNulls" : false }, { - "operator" : ">", + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "MIN", + "ignoreNulls" : false }, { - "operator" : "AND", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "operator" : ">", - "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { "column" : 7, - "type" : "BIGINT" + "type" : "INTEGER" }, { - "operator" : "0", - "operand" : [ ], + "column" : 5, "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "$THROW_UNLESS", - "operand" : [ { - "operator" : "OR", + }, { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS NULL", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "column" : 6, + "type" : "INTEGER" }, { - "operator" : "IS TRUE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" } ], - "type" : "BOOLEAN" + "operator" : ">" }, { - "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "column" : 2, + "type" : "VARCHAR" }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 6, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'%ok%'" + } ], + "operator" : "LIKE" } ] } } } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + }, + "target" : [ { + "column" : 0, "type" : "INTEGER" }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" + "column" : 2, + "type" : "INTEGER" }, { - "operator" : "$SUM0", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, + "column" : 5, "type" : "INTEGER" }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : ">" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { - "column" : 0, - "type" : "INTEGER" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" }, { - "column" : 1, - "type" : "INTEGER" + "type" : "BOOLEAN", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "IS NULL" } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "AND", + "operator" : "AND" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 2, + "type" : "INTEGER" }, { - "operator" : "$THROW_UNLESS", - "operand" : [ { - "operator" : "OR", - "operand" : [ { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS NULL", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS TRUE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" + "column" : 3, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", + "operator" : "=" + } ], + "operator" : "IS TRUE" + } ], + "operator" : "OR" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'" + } ], + "operator" : "$THROW_UNLESS" + } ], + "operator" : "AND" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : ">" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : ">" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", "operand" : [ { "column" : 5, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "IS NULL" }, { - "operator" : "AND", + "type" : "BOOLEAN", "operand" : [ { - "operator" : ">", - "operand" : [ { - "column" : 8, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "$THROW_UNLESS", - "operand" : [ { - "operator" : "OR", - "operand" : [ { - "operator" : "AND", - "operand" : [ { - "operator" : "IS NULL", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS NULL", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "IS TRUE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" + "column" : 6, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", + "operator" : "IS NULL" + } ], + "operator" : "AND" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", "operand" : [ { - "column" : 8, - "type" : "BIGINT" + "column" : 5, + "type" : "INTEGER" }, { - "operator" : "0", - "operand" : [ ], + "column" : 6, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "=" } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } + "operator" : "IS TRUE" + } ], + "operator" : "OR" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'" + } ], + "operator" : "$THROW_UNLESS" + } ], + "operator" : "AND" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 7, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : ">" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 1, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "CASE" + }, { + "column" : 4, + "type" : "BIGINT" + } ] } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "CASE" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BIGINT", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "BIGINT" + } ], + "operator" : "/" + } ], + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($3) FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/($3, $4)):INTEGER])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $f2=[$2], $f3=[CASE(=($4, 0), null:INTEGER, $3)], $f4=[$4])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $4], agg#2=[$SUM0($2) FILTER $5], agg#3=[COUNT() FILTER $6])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f5=[$5], $f8=[AND(>($4, 0), $THROW_UNLESS(OR(AND(IS NULL($2), IS NULL($3)), IS TRUE(=($2, $3))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f9=[>($4, 0)], $f10=[AND(>($7, 0), $THROW_UNLESS(OR(AND(IS NULL($5), IS NULL($6)), IS TRUE(=($5, $6))), 'more than one distinct value in agg UNIQUE_VALUE'))], $f11=[>($7, 0)])\n LogicalAggregate(group=[{0, 3}], agg#0=[MIN($1) FILTER $2], agg#1=[MAX($1) FILTER $2], agg#2=[COUNT() FILTER $2], agg#3=[MIN($4) FILTER $5], agg#4=[MAX($4) FILTER $5], agg#5=[COUNT() FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json b/tests/calcite/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json index 4552991..1a3660c 100644 --- a/tests/calcite/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json +++ b/tests/calcite/testWithinDistinctFilteredAggsUniformDistinctKeysNoThrow.json @@ -1,192 +1,244 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($3) FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/($3, $4)):INTEGER])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $f2=[$2], $f3=[CASE(=($4, 0), null:INTEGER, $3)], $f4=[$4])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $3], agg#2=[$SUM0($2) FILTER $4], agg#3=[COUNT() FILTER $4])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f4=[$4], $f6=[>($3, 0)], $f7=[>($5, 0)])\n LogicalAggregate(group=[{0, 3}], agg#0=[MIN($1) FILTER $2], agg#1=[COUNT() FILTER $2], agg#2=[MIN($4) FILTER $5], agg#3=[COUNT() FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 0, + "column" : 7, "type" : "INTEGER" - } ], + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : ">" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'%ok%'" + } ], + "operator" : "LIKE" + } ] + } + } + } + }, { + "project" : { + "source" : { + "project" : { "source" : { - "project" : { - "target" : [ { - "column" : 7, + "group" : { + "keys" : [ { + "column" : 0, "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : ">", + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], + "column" : 1, "type" : "INTEGER" } ], - "type" : "BOOLEAN" - }, { - "column" : 2, - "type" : "VARCHAR" + "operator" : "$SUM0", + "ignoreNulls" : false }, { - "column" : 6, - "type" : "INTEGER" + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false }, { - "operator" : "LIKE", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" + "column" : 2, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "$SUM0", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "SUM", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "AVG", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { + "project" : { + "source" : { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false + } ], + "source" : { + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 6, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "10" + } ], + "operator" : ">" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 1, + "type" : "VARCHAR" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'%ok%'" + } ], + "operator" : "LIKE" + } ] + } + } + } + }, + "target" : [ { "column" : 0, "type" : "INTEGER" }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, + "column" : 2, "type" : "INTEGER" }, { - "column" : 6, + "column" : 4, "type" : "INTEGER" }, { - "operator" : ">", + "type" : "BOOLEAN", "operand" : [ { - "column" : 7, - "type" : "INTEGER" + "column" : 3, + "type" : "BIGINT" }, { - "operator" : "10", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" + "operator" : ">" }, { - "operator" : "LIKE", + "type" : "BOOLEAN", "operand" : [ { - "column" : 2, - "type" : "VARCHAR" + "column" : 5, + "type" : "BIGINT" }, { - "operator" : "_ISO-8859-1'%ok%'", + "type" : "INTEGER", "operand" : [ ], - "type" : "CHAR" + "operator" : "0" } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } + "operator" : ">" + } ] } } } - } - } - } ] - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "CASE", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "NULL", - "operand" : [ ], - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "operator" : "CAST", - "operand" : [ { - "operator" : "/", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "BIGINT" - } ], - "type" : "BIGINT" - } ], - "type" : "INTEGER" - } ], - "source" : { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -197,495 +249,73 @@ "column" : 2, "type" : "BIGINT" }, { - "operator" : "CASE", + "type" : "INTEGER", "operand" : [ { - "operator" : "=", + "type" : "BOOLEAN", "operand" : [ { "column" : 4, "type" : "BIGINT" }, { - "operator" : "0", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "0" } ], - "type" : "BOOLEAN" + "operator" : "=" }, { - "operator" : "NULL", + "type" : "INTEGER", "operand" : [ ], - "type" : "INTEGER" + "operator" : "NULL" }, { "column" : 3, "type" : "INTEGER" } ], + "operator" : "CASE" + }, { + "column" : 4, + "type" : "BIGINT" + } ] + } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" + } ], + "operator" : "=" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "NULL" + }, { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "CASE" + }, { + "type" : "INTEGER", + "operand" : [ { + "type" : "BIGINT", + "operand" : [ { + "column" : 3, "type" : "INTEGER" }, { "column" : 4, "type" : "BIGINT" } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 3, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 3, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "$SUM0", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : ">", - "operand" : [ { - "column" : 6, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 7, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "operator" : ">", - "operand" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "10", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - }, { - "operator" : "LIKE", - "operand" : [ { - "column" : 4, - "type" : "VARCHAR" - }, { - "operator" : "_ISO-8859-1'%ok%'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } - } - } ] - } - } - } - } + "operator" : "/" + } ], + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($3) FILTER $2], EXPR$2=[AVG($4) WITHIN DISTINCT ($3) FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[CASE(=($2, 0), null:INTEGER, $1)], EXPR$2=[CAST(/($3, $4)):INTEGER])\n LogicalProject(DEPTNO=[$0], EXPR$1=[$1], $f2=[$2], $f3=[CASE(=($4, 0), null:INTEGER, $3)], $f4=[$4])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[COUNT() FILTER $3], agg#2=[$SUM0($2) FILTER $4], agg#3=[COUNT() FILTER $4])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f4=[$4], $f6=[>($3, 0)], $f7=[>($5, 0)])\n LogicalAggregate(group=[{0, 3}], agg#0=[MIN($1) FILTER $2], agg#1=[COUNT() FILTER $2], agg#2=[MIN($4) FILTER $5], agg#3=[COUNT() FILTER $5])\n LogicalProject(DEPTNO=[$7], SAL=[$5], $f2=[>($6, 10)], JOB=[$2], COMM=[$6], $f5=[LIKE($1, '%ok%')])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testWithinDistinctNoThrow.json b/tests/calcite/testWithinDistinctNoThrow.json index 4696d6f..50d3982 100644 --- a/tests/calcite/testWithinDistinctNoThrow.json +++ b/tests/calcite/testWithinDistinctNoThrow.json @@ -1,464 +1,194 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[SUM($1) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], $f1=[CAST($1):INTEGER NOT NULL], $f2=[$2])\n LogicalAggregate(group=[{0}], agg#0=[MIN($1) FILTER $3], agg#1=[$SUM0($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f3=[$3], $f5=[=($4, 1)], $f6=[=($4, 0)])\n LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}]], agg#0=[$SUM0($1)], agg#1=[MIN($1)], agg#2=[GROUPING($0, $2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 2, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "MIN", + "ignoreNulls" : false }, { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "$SUM0", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - }, { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "operator" : "CAST", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], "source" : { - "project" : { - "target" : [ { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" }, { "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "$SUM0", + "ignoreNulls" : false }, { - "operator" : "=", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], + "column" : 1, "type" : "INTEGER" } ], - "type" : "BOOLEAN" + "operator" : "MIN", + "ignoreNulls" : false }, { - "operator" : "=", + "distinct" : false, + "type" : "BIGINT", "operand" : [ { - "column" : 4, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], + "column" : 0, "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" + "operator" : "GROUPING", + "ignoreNulls" : false } ], "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } + "column" : 2, + "type" : "VARCHAR" } ] } } } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", "operand" : [ { - "column" : 2, - "type" : "INTEGER" + "column" : 4, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "1" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "=" }, { - "operator" : "$SUM0", + "type" : "BOOLEAN", "operand" : [ { - "column" : 3, - "type" : "INTEGER" + "column" : 4, + "type" : "BIGINT" + }, { + "type" : "INTEGER", + "operand" : [ ], + "operator" : "0" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" - }, { - "operator" : "1", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "BIGINT" - }, { - "operator" : "0", - "operand" : [ ], - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "GROUPING", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } + "operator" : "=" + } ] } - } ] + } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "CAST" + }, { + "column" : 2, + "type" : "INTEGER" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)], EXPR$2=[SUM($1) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], $f1=[CAST($1):INTEGER NOT NULL], $f2=[$2])\n LogicalAggregate(group=[{0}], agg#0=[MIN($1) FILTER $3], agg#1=[$SUM0($2) FILTER $4])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f3=[$3], $f5=[=($4, 1)], $f6=[=($4, 0)])\n LogicalAggregate(group=[{0, 2}], groups=[[{0, 2}, {0}]], agg#0=[$SUM0($1)], agg#1=[MIN($1)], agg#2=[GROUPING($0, $2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testWithinDistinctUniformDistinctKeys.json b/tests/calcite/testWithinDistinctUniformDistinctKeys.json index 51b64db..ecceab2 100644 --- a/tests/calcite/testWithinDistinctUniformDistinctKeys.json +++ b/tests/calcite/testWithinDistinctUniformDistinctKeys.json @@ -1,106 +1,212 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($2)], EXPR$2=[AVG($3) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[$SUM0($2) FILTER $4], agg#2=[COUNT()])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f4=[$4], $f6=[$THROW_UNLESS(=($2, $3), 'more than one distinct value in agg UNIQUE_VALUE')], $f7=[$THROW_UNLESS(=($4, $5), 'more than one distinct value in agg UNIQUE_VALUE')])\n LogicalAggregate(group=[{0, 2}], agg#0=[MIN($1)], agg#1=[MAX($1)], agg#2=[MIN($3)], agg#3=[MAX($3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 2, + "column" : 1, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "$SUM0", + "ignoreNulls" : false }, { - "operator" : "AVG", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 4, + "column" : 2, "type" : "INTEGER" } ], + "operator" : "$SUM0", + "ignoreNulls" : false + }, { "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" }, { - "column" : 1, - "type" : "INTEGER" + "column" : 2, + "type" : "VARCHAR" } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false }, { - "column" : 6, - "type" : "INTEGER" + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false }, { - "column" : 3, - "type" : "VARCHAR" + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false }, { - "column" : 7, - "type" : "INTEGER" + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "MAX", + "ignoreNulls" : false } ], "source" : { - "scan" : 0 + "project" : { + "source" : { + "scan" : 0 + }, + "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + } ] + } } } - } + }, + "target" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 4, + "type" : "INTEGER" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 2, + "type" : "INTEGER" + }, { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "=" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'" + } ], + "operator" : "$THROW_UNLESS" + }, { + "type" : "BOOLEAN", + "operand" : [ { + "type" : "BOOLEAN", + "operand" : [ { + "column" : 4, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + } ], + "operator" : "=" + }, { + "type" : "CHAR", + "operand" : [ ], + "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'" + } ], + "operator" : "$THROW_UNLESS" + } ] } } } - } ] - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -108,9 +214,9 @@ "column" : 1, "type" : "INTEGER" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -118,418 +224,10 @@ "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - }, { - "operator" : "$THROW_UNLESS", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "$THROW_UNLESS", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 2, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "$SUM0", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "operator" : "$THROW_UNLESS", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "$THROW_UNLESS", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "_ISO-8859-1'more than one distinct value in agg UNIQUE_VALUE'", - "operand" : [ ], - "type" : "CHAR" - } ], - "type" : "BOOLEAN" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MAX", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } - } - } ] - } - } + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($2)], EXPR$2=[AVG($3) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($1) FILTER $3], agg#1=[$SUM0($2) FILTER $4], agg#2=[COUNT()])\n LogicalProject(DEPTNO=[$0], $f2=[$2], $f4=[$4], $f6=[$THROW_UNLESS(=($2, $3), 'more than one distinct value in agg UNIQUE_VALUE')], $f7=[$THROW_UNLESS(=($4, $5), 'more than one distinct value in agg UNIQUE_VALUE')])\n LogicalAggregate(group=[{0, 2}], agg#0=[MIN($1)], agg#1=[MAX($1)], agg#2=[MIN($3)], agg#3=[MAX($3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file diff --git a/tests/calcite/testWithinDistinctUniformDistinctKeysNoThrow.json b/tests/calcite/testWithinDistinctUniformDistinctKeysNoThrow.json index a06b07c..1c06078 100644 --- a/tests/calcite/testWithinDistinctUniformDistinctKeysNoThrow.json +++ b/tests/calcite/testWithinDistinctUniformDistinctKeysNoThrow.json @@ -1,106 +1,144 @@ { + "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($2)], EXPR$2=[AVG($3) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($2)], agg#1=[$SUM0($3)], agg#2=[COUNT()])\n LogicalAggregate(group=[{0, 2}], agg#0=[MIN($1)], agg#1=[MIN($3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ], "schemas" : [ { - "name" : "EMP", - "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], "types" : [ "INTEGER", "VARCHAR", "VARCHAR", "INTEGER", "TIMESTAMP", "INTEGER", "INTEGER", "INTEGER", "BOOLEAN" ], - "strategy" : [ "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "NOT_NULLABLE", "DEFAULT", "NOT_NULLABLE" ], - "key" : [ [ 0 ] ], - "foreign" : [ ] + "nullable" : [ false, false, false, true, false, false, false, false, false ], + "name" : "CATALOG.SALES.EMP", + "guaranteed" : [ ], + "fields" : [ "EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER" ], + "key" : [ [ 0 ] ] } ], "queries" : [ { - "distinct" : { - "correlate" : [ { + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 1, + "type" : "INTEGER" + } ], + "operator" : "SUM", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "AVG", + "ignoreNulls" : false + } ], + "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { + "column" : 7, + "type" : "INTEGER" + }, { + "column" : 5, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + }, { + "column" : 6, + "type" : "INTEGER" + } ] + } + } + } + }, { + "project" : { + "source" : { + "group" : { + "keys" : [ { "column" : 0, "type" : "INTEGER" } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { "function" : [ { - "operator" : "SUM", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { "column" : 2, "type" : "INTEGER" } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "operator" : "$SUM0", + "ignoreNulls" : false }, { - "operator" : "AVG", + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "column" : 4, + "column" : 3, "type" : "INTEGER" } ], + "operator" : "$SUM0", + "ignoreNulls" : false + }, { "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" + "type" : "BIGINT", + "operand" : [ ], + "operator" : "COUNT", + "ignoreNulls" : false } ], "source" : { - "filter" : { - "condition" : { - "operator" : "AND", + "group" : { + "keys" : [ { + "column" : 0, + "type" : "INTEGER" + }, { + "column" : 2, + "type" : "VARCHAR" + } ], + "function" : [ { + "distinct" : false, + "type" : "INTEGER", "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" + "column" : 1, + "type" : "INTEGER" } ], - "type" : "BOOLEAN" - }, + "operator" : "MIN", + "ignoreNulls" : false + }, { + "distinct" : false, + "type" : "INTEGER", + "operand" : [ { + "column" : 3, + "type" : "INTEGER" + } ], + "operator" : "MIN", + "ignoreNulls" : false + } ], "source" : { "project" : { + "source" : { + "scan" : 0 + }, "target" : [ { - "column" : 8, + "column" : 7, "type" : "INTEGER" }, { - "column" : 6, + "column" : 5, "type" : "INTEGER" }, { - "column" : 3, + "column" : 2, "type" : "VARCHAR" }, { - "column" : 7, + "column" : 6, "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } + } ] } } } } } - } ] - } - }, { - "project" : { + }, "target" : [ { "column" : 0, "type" : "INTEGER" @@ -108,9 +146,9 @@ "column" : 1, "type" : "INTEGER" }, { - "operator" : "CAST", + "type" : "INTEGER", "operand" : [ { - "operator" : "/", + "type" : "BIGINT", "operand" : [ { "column" : 2, "type" : "INTEGER" @@ -118,282 +156,10 @@ "column" : 3, "type" : "BIGINT" } ], - "type" : "BIGINT" + "operator" : "/" } ], - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - } ], - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 6, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 5, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 2, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "VARCHAR" - }, { - "column" : 4, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 9, - "type" : "INTEGER" - }, { - "column" : 7, - "type" : "INTEGER" - }, { - "column" : 4, - "type" : "VARCHAR" - }, { - "column" : 8, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "$SUM0", - "operand" : [ { - "column" : 3, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "$SUM0", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "COUNT", - "operand" : [ ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "BIGINT" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 0, - "type" : "INTEGER" - }, { - "column" : 1, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "distinct" : { - "correlate" : [ { - "project" : { - "target" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - } ], - "source" : { - "project" : { - "target" : [ { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 6, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "VARCHAR" - }, { - "column" : 7, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - }, { - "aggregate" : { - "function" : [ { - "operator" : "MIN", - "operand" : [ { - "column" : 4, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - }, { - "operator" : "MIN", - "operand" : [ { - "column" : 6, - "type" : "INTEGER" - } ], - "distinct" : false, - "ignoreNulls" : false, - "type" : "INTEGER" - } ], - "source" : { - "filter" : { - "condition" : { - "operator" : "AND", - "operand" : [ { - "operator" : "=", - "operand" : [ { - "column" : 1, - "type" : "INTEGER" - }, { - "column" : 3, - "type" : "INTEGER" - } ], - "type" : "BOOLEAN" - }, { - "operator" : "=", - "operand" : [ { - "column" : 2, - "type" : "VARCHAR" - }, { - "column" : 5, - "type" : "VARCHAR" - } ], - "type" : "BOOLEAN" - } ], - "type" : "BOOLEAN" - }, - "source" : { - "project" : { - "target" : [ { - "column" : 10, - "type" : "INTEGER" - }, { - "column" : 8, - "type" : "INTEGER" - }, { - "column" : 5, - "type" : "VARCHAR" - }, { - "column" : 9, - "type" : "INTEGER" - } ], - "source" : { - "scan" : 0 - } - } - } - } - } - } - } ] - } - } - } - } - } - } ] - } - } + "operator" : "CAST" + } ] } - } ], - "help" : [ "LogicalAggregate(group=[{0}], EXPR$1=[SUM($1) WITHIN DISTINCT ($2)], EXPR$2=[AVG($3) WITHIN DISTINCT ($2)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n", "LogicalProject(DEPTNO=[$0], EXPR$1=[$1], EXPR$2=[CAST(/($2, $3)):INTEGER NOT NULL])\n LogicalAggregate(group=[{0}], agg#0=[$SUM0($2)], agg#1=[$SUM0($3)], agg#2=[COUNT()])\n LogicalAggregate(group=[{0, 2}], agg#0=[MIN($1)], agg#1=[MIN($3)])\n LogicalProject(DEPTNO=[$7], SAL=[$5], JOB=[$2], COMM=[$6])\n LogicalTableScan(table=[[CATALOG, SALES, EMP]])\n" ] + } ] } \ No newline at end of file From c4c31dfb17b6b4234f0f05673f19160108b86ca6 Mon Sep 17 00:00:00 2001 From: Shuxian Wang Date: Sun, 19 Nov 2023 23:38:17 -0500 Subject: [PATCH 11/11] Update naming. --- .envrc | 1 + Cargo.lock | 46 ++++++++-------- Cargo.toml | 2 +- LICENSE | 2 +- README.md | 116 +++++++++++++++++------------------------ flake.nix | 8 +-- src/pipeline/shared.rs | 4 +- 7 files changed, 78 insertions(+), 101 deletions(-) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/Cargo.lock b/Cargo.lock index 4e4d95c..47e8672 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -93,29 +93,6 @@ dependencies = [ "libloading", ] -[[package]] -name = "cosette-prover" -version = "0.1.0" -dependencies = [ - "anyhow", - "crossbeam", - "env_logger", - "imbl", - "indenter", - "isoperm", - "itertools", - "log", - "num", - "paste", - "permutation", - "scopeguard", - "serde", - "serde-enum-str", - "serde_json", - "walkdir", - "z3", -] - [[package]] name = "crossbeam" version = "0.8.2" @@ -507,6 +484,29 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "qed-prover" +version = "0.1.0" +dependencies = [ + "anyhow", + "crossbeam", + "env_logger", + "imbl", + "indenter", + "isoperm", + "itertools", + "log", + "num", + "paste", + "permutation", + "scopeguard", + "serde", + "serde-enum-str", + "serde_json", + "walkdir", + "z3", +] + [[package]] name = "quote" version = "1.0.33" diff --git a/Cargo.toml b/Cargo.toml index 8a4203e..11b05d4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "cosette-prover" +name = "qed-prover" version = "0.1.0" authors = ["Shuxian Wang "] edition = "2018" diff --git a/LICENSE b/LICENSE index 985b15a..7c17874 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 The Cosette Team +Copyright (c) 2021 The QED Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 61154d9..2511bfb 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,66 @@ -# The Cosette Prover +# The QED Prover -This is a reimplementation of the Cosette prover in Rust aiming for high performance and better SQL feature coverage. -The theory behind the prover is described in [this paper](https://www.vldb.org/pvldb/vol11/p1482-chu.pdf). -It currently expect input generated from [this parser](https://github.com/cosette-solver/cosette-parser). +This is a SQL query equivalence prover in Rust aiming for high performance and large SQL feature coverage. +The project starts as a successor of the Cosette prover, which is described in [this paper](https://www.vldb.org/pvldb/vol11/p1482-chu.pdf). -## Usage +## Install + +### Build from source manually -After downloading the source, build the source with +The project relies on a nightly Rust compiler toolchain, +and additionally, `libclang` and header files for `z3` are needed as build-time dependencies. +Build the prover with ```sh cargo build --release ``` -Currently the build-time dependency are `libclang` and header files for `z3`. -Also, a nightly Rust compiler toolchain is required. -The build should produce an executable in `target/release/`, or you can use `cargo` to run: +would produce an executable `./target/release/qed-prover`. +The current setup of the prover has the Z3 *and* CVC5 solver as a runtime dependency, +so you need to have both the `z3` *and* `cvc5` executable in the `PATH` when running `qed-solver`. + +### Build with Nix + +Alternatively, if one has Nix and Nix flake in their environment, this project contains a flake for easy reproducibility. +Simply use ```sh -cargo run --release -- +nix run github:qed-solver/prover -- ``` -where the `` are paths to input files or directories containing the files. -The current setup of the solver has the Z3 *and* CVC5 solver as a runtime dependency, -so you need to have both the `z3` *and* `cvc5` executable in the `PATH` when running Cosette. -The results will be simply printed out, with the name of each file and their result (provable/not provable). -You can set the environment variable to `RUST_LOG=info` when running and get a (very) verbose output. +to run the prover with arguments ``. + +To have a development environment with all the build-time and runtime dependencies, run `nix shell .` in the project's root. +For `direnv` users, a `.envrc` file is also prepared, so simply `cd` into the project directory, and `direnv` will try to reproduce the development environment. +(NOTICE: For first-time use, you need to explicitly trust the `.envrc` file, by executing `direnv allow .`) + +## Usage + +Normally, one invoke the parser as +```sh +qed-prover [input-path]... +``` +where every `input-path` is a JSON file that represents a case to prove, or a directory containing such files. +Currently one can generate conforming JSON files using [this parser](https://github.com/qed-solver/parser) by passing in SQL statements. + +During execution, the results will simply be printed out, with the names of every files followed by their result (provable/not provable). +One can use the environment variable `QED_SMT_TIMEOUT` to set a timeout for each SMT request the prover makes in milliseconds, which is defaulted to 10,000. +Setting the environment variable `RUST_LOG=info` when running would give a (very) verbose output. This is useful for debugging as it prints out how expressions are simplified in the solver at various stages. -Then input files should be generated by the parser. -They are all in JSON format. -The directory `tests/RelOptRulesTest/` contains such files that are directly extracted from the [Calcite](https://calcite.apache.org/) project. +### Test cases + +For convience, the directory `tests/calcite/` contains JSON files representing the query rewrite pairs use in the optimizer test suite of the [Calcite](https://calcite.apache.org/) project. You may try out running these inputs by ```sh -cargo run --release -- tests/RelOptRulesTest/ +qed-prover tests/calcite/ ``` -WARNING: many test cases in this folder contain features that we haven't support yet. -Now ~200 out of all ~380 cases are actually provable. +WARNING: some test cases in this folder contain features that we haven't support yet. +Now ~290 out of all ~440 cases are actually provable. ## Feature coverage ### Supported features + - Basic `SELECT-FROM-WHERE` queries -- Set operations (`UNION`, `UNION ALL`, `EXCEPT`, and `EXCEPT ALL`) -- Joins (`INNER JOIN`, `LEFT`/`RIGHT`/`FULL` `OUTER JOIN`, `SEMI`/`ANTI` `JOIN`, and correlated join) +- Set operations (`UNION`, `UNION ALL`, `INTERSECT` (but not `INTERSECT ALL`), `EXCEPT`, and `EXCEPT ALL`) +- Joins (`INNER JOIN`, `LEFT`/`RIGHT`/`FULL` `OUTER JOIN`, `SEMI`/`ANTI` `JOIN`, and lateral/correlated join) - `DISTINCT` - `VALUES` - Aggretation (as uninterpreted functions) @@ -48,55 +70,11 @@ Now ~200 out of all ~380 cases are actually provable. - Arbitrary `CHECK` constraints ### Planned features + - Foreign key constraint - Law of excluded middle ($A + \neg A = 1$) -- `INTERSECT` (but not `INTERSECT ALL`) ### Unsupported features + - Semantics of aggretations, such as understanding them as algebras over a monad - Semantics of `ORDER BY` and `LIMIT` (requires temporarily modelling a table as list?) - -## Reproducible environment - -### With Nix - -The project contains a Nix flake for easy reproducibility. -Simply use `nix run . -- ` to run the prover. -For `direnv` user, create the `.envrc` file in the project root directory with the content -``` -use flake -``` -(NOTICE: For first-time use, you need to explicitly trust the `.envrc` file, and execute `direnv allow .` to proceed with the build) -Now simply `cd` into the project directory, and `direnv` will try to reproduce the development environment. - -### With GNU Guix - -All the development dependencies are declared in `manifest.scm`, with packages drawn from `channels.scm`. -The `channels.lock` file is then derived from `channels.scm` to pin down channels to their exact Git commit hashes. -Finally, one can use `direnv` to automatically reproduce the declared environment after entering the project directory. - -To run with this setup, add the following to `~/.config/direnv/direnvrc`. -```bash -use_guix-shell() { - local profile=./.profile - local channels=./channels.lock - [ -L $profile ] && rm $profile - if [ -f $channels ]; then - eval "$(guix time-machine -C "$channels" -- shell -r "$profile" "$@" --search-paths)" - else - eval "$(guix shell -r "$profile" "$@" --search-paths)" - fi -} -``` -And create the `.envrc` file under the project root directory with content -``` -use guix-shell -``` -(NOTICE: For first-time use, you need to explicitly trust the `.envrc` file, and execute `direnv allow .` to proceed with the build) -Now simply `cd` into the project directory, and `direnv` will try to reproduce the development environment. - -Within the development envrionment created by `direnv`, one can then use the convensional -``` -cargo run --release -- -``` -to run the Cosette prover. diff --git a/flake.nix b/flake.nix index a4fac89..609743f 100644 --- a/flake.nix +++ b/flake.nix @@ -30,16 +30,16 @@ ++ lib.optionals stdenv.isDarwin [ libiconv ]; }; cargoArtifacts = craneLib.buildDepsOnly packageDef; - cosette-prover = craneLib.buildPackage (packageDef // { + qed-prover = craneLib.buildPackage (packageDef // { inherit cargoArtifacts; doNotLinkInheritedArtifacts = true; - postInstall = with pkgs; "wrapProgram $out/bin/cosette-prover --set PATH ${lib.makeBinPath [ cvc5 z3_4_12 ]}"; + postInstall = with pkgs; "wrapProgram $out/bin/qed-prover --set PATH ${lib.makeBinPath [ cvc5 z3_4_12 ]}"; }); in { - packages.default = cosette-prover; + packages.default = qed-prover; devShells.default = pkgs.mkShell { - inputsFrom = [ cosette-prover ]; + inputsFrom = [ qed-prover ]; packages = with pkgs; [ rust-analyzer julia-bin jless ] ++ lib.optionals stdenv.isLinux [ linuxPackages.perf ]; }; }); diff --git a/src/pipeline/shared.rs b/src/pipeline/shared.rs index c0d664f..76fea7d 100644 --- a/src/pipeline/shared.rs +++ b/src/pipeline/shared.rs @@ -513,9 +513,7 @@ impl<'c> Ctx<'c> { } pub fn timeout() -> Duration { - if let Some(t) = - std::env::var("COSETTE_SMT_TIMEOUT").ok().and_then(|t| t.parse::().ok()) - { + if let Some(t) = std::env::var("QED_SMT_TIMEOUT").ok().and_then(|t| t.parse::().ok()) { Duration::from_millis(t) } else { Duration::from_secs(10)